summaryrefslogtreecommitdiff
path: root/test/stdlib
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2012-01-29 17:48:54 +0100
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2012-01-29 18:31:16 +0100
commit7c721d31e4b7a0bdf6f803b8e7c38996bf60b59f (patch)
tree217d8054855c8c3b57c1d9ac24d83641aa566253 /test/stdlib
parentfba639dcdcc2f3fede71e8bcd1a1a525a7f57d61 (diff)
tmpnam, tempnam are obsolete in SUSV4
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'test/stdlib')
-rw-r--r--test/stdlib/test-canon2.c18
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);
}