diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2024-10-20 15:21:43 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2024-10-20 15:21:43 +0200 |
commit | 4682deeb62247d34de87f8e777f99e2d337fd377 (patch) | |
tree | 5bd5b5605b5f3a4b3c8ea7468c34c23094afdef4 /tests/nap.h | |
parent | 00893e79fc62966067af1a106567db96bd170338 (diff) |
New upstream version 1.3upstream/1.3upstream
Diffstat (limited to 'tests/nap.h')
-rw-r--r-- | tests/nap.h | 14 |
1 files changed, 10 insertions, 4 deletions
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 <limits.h> - # include <stdckdint.h> +# 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 <unistd.h> @@ -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 <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-writefile> */ 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 |