summaryrefslogtreecommitdiff
path: root/trafgen.c
diff options
context:
space:
mode:
Diffstat (limited to 'trafgen.c')
-rw-r--r--trafgen.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/trafgen.c b/trafgen.c
index 949f909..002b01a 100644
--- a/trafgen.c
+++ b/trafgen.c
@@ -417,15 +417,9 @@ static struct cpu_stats *setup_shared_var(unsigned int cpus)
char *zbuff, file[256];
struct cpu_stats *buff;
+ slprintf(file, sizeof(file), ".tmp_mmap.XXXXXX");
+ fd = mkostemp_or_die(file, O_RDWR | O_CREAT | O_TRUNC);
zbuff = xzmalloc(len);
- slprintf(file, sizeof(file), ".tmp_mmap.%u", (unsigned int) rand());
-
- fd = creat(file, S_IRUSR | S_IWUSR);
- bug_on(fd < 0);
- close(fd);
-
- fd = open_or_die_m(file, O_RDWR | O_CREAT | O_TRUNC,
- S_IRUSR | S_IWUSR);
write_or_die(fd, zbuff, len);
xfree(zbuff);