From 7c721d31e4b7a0bdf6f803b8e7c38996bf60b59f Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Sun, 29 Jan 2012 17:48:54 +0100 Subject: tmpnam, tempnam are obsolete in SUSV4 Signed-off-by: Bernhard Reutner-Fischer --- test/stdlib/test-canon2.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'test/stdlib') 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); } -- cgit v1.2.3