diff options
Diffstat (limited to 'test/stdlib/test-canon2.c')
-rw-r--r-- | test/stdlib/test-canon2.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/test/stdlib/test-canon2.c b/test/stdlib/test-canon2.c index f182e95ad..e7e02e55e 100644 --- a/test/stdlib/test-canon2.c +++ b/test/stdlib/test-canon2.c @@ -40,6 +40,7 @@ void do_prepare (int argc, char *argv[]) { size_t test_dir_len; + int tfd; test_dir_len = strlen (test_dir); @@ -48,9 +49,20 @@ do_prepare (int argc, char *argv[]) mempcpy (mempcpy (name1, test_dir, test_dir_len), "/canonXXXXXX", sizeof ("/canonXXXXXX")); name2 = strdup (name1); - - add_temp_file (mktemp (name1)); - add_temp_file (mktemp (name2)); + tfd = mkstemp(name1); + if (tfd < 0) { + printf("%s: cannot generate temp file name\n", __FUNCTION__); + exit(1); + } + close(tfd); + add_temp_file (name1); + tfd = mkstemp(name2); + if (tfd < 0) { + printf("%s: cannot generate temp file name\n", __FUNCTION__); + exit(1); + } + close(tfd); + add_temp_file (name2); } |