]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
fstatat: extend tests and documentation
authorMatteo Croce <teknoraver@meta.com>
Sat, 14 Jun 2025 09:59:03 +0000 (11:59 +0200)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 8 Jul 2025 16:18:08 +0000 (13:18 -0300)
Document the fstatat behaviour leading to a ENOENT errno, and extend
tests to test the case where filename does not exist.

Signed-off-by: Matteo Croce <teknoraver@meta.com>
io/tst-stat-time64.c
io/tst-stat.c
manual/filesys.texi

index a20265c570fcb3fa70cdd9b674877271fe668c14..4415765c8a0e5526ad7e4da3aabe7a200ee084a0 100644 (file)
@@ -52,6 +52,12 @@ fstat_check (int fd, const char *path, struct stat *st)
 static void
 fstatat_check (int fd, const char *path, struct stat *st)
 {
+  TEST_COMPARE (fstatat (fd, "", st, 0), -1);
+  TEST_COMPARE (errno, ENOENT);
+
+  TEST_COMPARE (fstatat (AT_FDCWD, "_non_existing_file", st, 0), -1);
+  TEST_COMPARE (errno, ENOENT);
+
   TEST_COMPARE (fstatat (fd, path, st, 0), 0);
 }
 
index cc57aec45c598b2ebae830096a86f6641a1ac069..61bdbfb6380a5051431ee34c102661161d935a50 100644 (file)
@@ -56,6 +56,9 @@ fstatat_check (int fd, const char *path, struct stat *st)
   TEST_COMPARE (fstatat (fd, "", st, 0), -1);
   TEST_COMPARE (errno, ENOENT);
 
+  TEST_COMPARE (fstatat (AT_FDCWD, "_non_existing_file", st, 0), -1);
+  TEST_COMPARE (errno, ENOENT);
+
   TEST_COMPARE (fstatat (fd, path, st, 0), 0);
 }
 
index e1c7be867edbb4a6272e71fc2a9108456a9a110d..fb7986cff720b7d266d026ba7b93509d0d04faa9 100644 (file)
@@ -2398,6 +2398,10 @@ The @var{flags} argument is not valid for this function.
 @item ENOTDIR
 The descriptor @var{filedes} is not associated with a directory, and
 @var{filename} is a relative file name.
+
+@item ENOENT
+The file named by @var{filename} does not exist, or @var{filename} is an
+empty string and @var{flags} does not contain @code{AT_EMPTY_PATH}.
 @end table
 
 When the sources are compiled with @code{_FILE_OFFSET_BITS == 64} this