[beast: 6/16] TOOLS: bwtwave: avoid redundant use of mktemp



commit 6c10e3ca257b36f5307a6424cae7bd3ebe14ca84
Author: Tim Janik <timj gnu org>
Date:   Wed Sep 6 03:54:55 2017 +0200

    TOOLS: bwtwave: avoid redundant use of mktemp
    
    Signed-off-by: Tim Janik <timj gnu org>

 tools/bwtwave.cc |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
---
diff --git a/tools/bwtwave.cc b/tools/bwtwave.cc
index 1fb4b84..19fbf8c 100644
--- a/tools/bwtwave.cc
+++ b/tools/bwtwave.cc
@@ -244,8 +244,7 @@ Wave::store (const string file_name)
   do
     {
       g_free (temp_file);
-      temp_file = g_strdup_format ("%s.tmp%06xyXXXXXX", file_name.c_str(), rand() & 0xfffffd);
-      mktemp (temp_file); /* this is save, due to use of: O_CREAT | O_EXCL */
+      temp_file = g_strdup_format ("%s.tmp%06x", file_name.c_str(), rand() & 0xfffffd);
       fd = open (temp_file, O_WRONLY | O_CREAT | O_EXCL, 0666);
     }
   while (fd < 0 && errno == EEXIST);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]