about summary refs log tree commit diff
path: root/posix/tst-preadwrite.c
diff options
context:
space:
mode:
Diffstat (limited to 'posix/tst-preadwrite.c')
-rw-r--r--posix/tst-preadwrite.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/posix/tst-preadwrite.c b/posix/tst-preadwrite.c
index 6a71e4f5d5..d1dcdcc67c 100644
--- a/posix/tst-preadwrite.c
+++ b/posix/tst-preadwrite.c
@@ -54,16 +54,18 @@ do_prepare (int argc, char *argv[])
 {
    char name_len;
 
-     name_len = strlen (test_dir);
-     name = malloc (name_len + sizeof ("/preadwriteXXXXXX"));
-     mempcpy (mempcpy (name, test_dir, name_len),
-	      "/preadwriteXXXXXX", sizeof ("/preadwriteXXXXXX"));
-     add_temp_file (name);
-
-     /* Open our test file.   */
-     fd = mkstemp (name);
-     if (fd == -1)
-       error (EXIT_FAILURE, errno, "cannot open test file `%s'", name);
+#define FNAME FNAME2(TRUNCATE)
+#define FNAME2(s) "/" STRINGIFY(s) "XXXXXX"
+
+   name_len = strlen (test_dir);
+   name = malloc (name_len + sizeof (FNAME));
+   mempcpy (mempcpy (name, test_dir, name_len), FNAME, sizeof (FNAME));
+   add_temp_file (name);
+
+   /* Open our test file.   */
+   fd = mkstemp (name);
+   if (fd == -1)
+     error (EXIT_FAILURE, errno, "cannot open test file `%s'", name);
 }