From 4682deeb62247d34de87f8e777f99e2d337fd377 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 20 Oct 2024 15:21:43 +0200 Subject: New upstream version 1.3 --- tests/nap.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'tests/nap.h') diff --git a/tests/nap.h b/tests/nap.h index cf7d998b..1b9ae592 100644 --- a/tests/nap.h +++ b/tests/nap.h @@ -20,9 +20,11 @@ # define GLTEST_NAP_H # include - # include +# include "concat-filename.h" +# include "xgetcwd.h" + /* Avoid a conflict with a function called nap() on UnixWare. */ # if defined _SCO_DS || (defined __SCO_VERSION__ || defined __sysv5__) /* OpenServer, UnixWare */ # include @@ -33,6 +35,9 @@ /* Name of the witness file. */ #define TEMPFILE BASE "nap.tmp" +/* Absolute name of the witness file. */ +static char *nap_file /* = NULL */; + /* File descriptor used for the witness file. */ static int nap_fd = -1; @@ -75,7 +80,7 @@ nap_get_stat (struct stat *st, int do_write) is closed. See */ close (nap_fd); - nap_fd = open (TEMPFILE, O_RDWR, 0600); + nap_fd = open (nap_file, O_RDWR, 0600); ASSERT (nap_fd != -1); lseek (nap_fd, 0, SEEK_END); #endif @@ -108,7 +113,7 @@ clear_temp_file (void) if (0 <= nap_fd) { ASSERT (close (nap_fd) != -1); - ASSERT (unlink (TEMPFILE) != -1); + ASSERT (unlink (nap_file) != -1); } } @@ -127,8 +132,9 @@ nap (void) if (-1 == nap_fd) { + nap_file = xconcatenated_filename (xgetcwd (), TEMPFILE, NULL); atexit (clear_temp_file); - ASSERT ((nap_fd = creat (TEMPFILE, 0600)) != -1); + ASSERT ((nap_fd = creat (nap_file, 0600)) != -1); nap_get_stat (&old_st, 0); } else -- cgit v1.2.3