From: Waldemar Kozaczuk <jwkozac...@gmail.com>
Committer: Nadav Har'El <n...@scylladb.com>
Branch: master

misc-fs-stress: replace mktemp with mkstemp to fix compiler warnings

Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com>
Message-Id: <20191209030913.1842-1-jwkozac...@gmail.com>

---
diff --git a/tests/misc-fs-stress.cc b/tests/misc-fs-stress.cc
--- a/tests/misc-fs-stress.cc
+++ b/tests/misc-fs-stress.cc
@@ -51,7 +51,14 @@ int main(int argc, char const *argv[])
     if (argc == 2) {
         fname = argv[1];
     } else {
-        mktemp(default_fname);
+        // Use mkstemp to capture name of a temporary file
+        auto fd = mkstemp(default_fname);
+        if (fd <= 0) {
+            perror("mkstemp");
+            return -1;
+        }
+        close(fd);
+        unlink(default_fname);
         fname = reinterpret_cast<const char *>(default_fname);
     }

--
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/000000000000c5dd6205994266e7%40google.com.

Reply via email to