mirror of git://sourceware.org/git/glibc.git
fstatat: extend tests and documentation
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>
This commit is contained in:
parent
6afece738c
commit
652c36b3ea
|
|
@ -52,6 +52,12 @@ fstat_check (int fd, const char *path, struct stat *st)
|
||||||
static void
|
static void
|
||||||
fstatat_check (int fd, const char *path, struct stat *st)
|
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);
|
TEST_COMPARE (fstatat (fd, path, st, 0), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,9 @@ fstatat_check (int fd, const char *path, struct stat *st)
|
||||||
TEST_COMPARE (fstatat (fd, "", st, 0), -1);
|
TEST_COMPARE (fstatat (fd, "", st, 0), -1);
|
||||||
TEST_COMPARE (errno, ENOENT);
|
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);
|
TEST_COMPARE (fstatat (fd, path, st, 0), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2398,6 +2398,10 @@ The @var{flags} argument is not valid for this function.
|
||||||
@item ENOTDIR
|
@item ENOTDIR
|
||||||
The descriptor @var{filedes} is not associated with a directory, and
|
The descriptor @var{filedes} is not associated with a directory, and
|
||||||
@var{filename} is a relative file name.
|
@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
|
@end table
|
||||||
|
|
||||||
When the sources are compiled with @code{_FILE_OFFSET_BITS == 64} this
|
When the sources are compiled with @code{_FILE_OFFSET_BITS == 64} this
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue