diff options
-rw-r--r-- | trafgen.c | 10 |
1 files changed, 2 insertions, 8 deletions
@@ -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); |