[PATCH] io/tst-stat.c: Call mktemp to create a temporary file
H.J. Lu
hjl.tools@gmail.com
Fri Jul 18 22:13:30 GMT 2025
Call mktemp to create a temporary file for symlink test under /tmp,
instead of a fixed file in the glibc source tree, to avoid the race
condition when there are more than one glibc tests running at the same
time with the same glibc source tree. This fixes BZ #33178.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
---
io/tst-stat.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/io/tst-stat.c b/io/tst-stat.c
index aeea435ca1..e76a3d2206 100644
--- a/io/tst-stat.c
+++ b/io/tst-stat.c
@@ -27,6 +27,7 @@
#include <sys/sysmacros.h>
#include <stdio.h>
#include <unistd.h>
+#include <stdlib.h>
static void
stat_check (int fd, const char *path, struct stat *st)
@@ -73,12 +74,13 @@ fstatat_link (const char *path, struct stat *st)
}
typedef void (*test_t)(int, const char *path, struct stat *);
+static char linkame[] = "/tmp/tst-fstat.linkname.XXXXXX";
static int
do_test (void)
{
char *path;
- const char *linkame = "tst-fstat.linkname";
+ TEST_VERIFY_EXIT (mktemp (linkame) != NULL);
int fd = create_temp_file ("tst-fstat.", &path);
TEST_VERIFY_EXIT (fd >= 0);
support_write_file_string (path, "abc");
--
2.50.1
More information about the Libc-alpha
mailing list