From: Waldemar Kozaczuk <jwkozac...@gmail.com>
Committer: Nadav Har'El <n...@scylladb.com>
Branch: master
tst-zfs-mount: replace mktemp with mkstemp to fix compiler warnings
Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com>
Message-Id: <20191209012233.30437-1-jwkozac...@gmail.com>
---
diff --git a/tests/tst-zfs-mount.cc b/tests/tst-zfs-mount.cc
--- a/tests/tst-zfs-mount.cc
+++ b/tests/tst-zfs-mount.cc
@@ -50,8 +50,14 @@ int check_zfs_refcnt_behavior(void)
}
old_mcount = mp->m_count;
+ // Use mkstemp to capture path of a temporary file used later
snprintf(file, 64, "%sfileXXXXXX", mount_path);
- mktemp(file);
+ fd = mkstemp(file);
+ if (fd <= 0) {
+ return -1;
+ }
+ close(fd);
+ unlink(file);
/* Create hard links, and remove them afterwards to exercise the
refcount code */
for (i = 0; i < 10; i++) {
@@ -69,8 +75,7 @@ int check_zfs_refcnt_behavior(void)
}
close(fd);
- snprintf(newfile, 64, "%snewfileXXXXXX", mount_path);
- mktemp(newfile);
+ snprintf(newfile, 64, "%snewfile", file);
/* Create a link to file into newfile */
ret = link(file, newfile);
--
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/0000000000008ba94c0599425e7d%40google.com.