diff options
Diffstat (limited to 'tests/test-fstat.c')
-rw-r--r-- | tests/test-fstat.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/test-fstat.c b/tests/test-fstat.c index 3af63136..2fda6963 100644 --- a/tests/test-fstat.c +++ b/tests/test-fstat.c @@ -1,5 +1,5 @@ /* Tests of fstat() function. - Copyright (C) 2011-2024 Free Software Foundation, Inc. + Copyright (C) 2011-2025 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,6 +22,7 @@ SIGNATURE_CHECK (fstat, int, (int, struct stat *)); #include <errno.h> +#include <fcntl.h> #include <unistd.h> #include "macros.h" @@ -46,5 +47,17 @@ main () ASSERT (errno == EBADF); } + /* /dev/null is a character device. */ + { + int fd; + struct stat statbuf; + + fd = open ("/dev/null", O_RDWR); + ASSERT (fstat (fd, &statbuf) == 0); + close (fd); + ASSERT (!S_ISREG (statbuf.st_mode)); + ASSERT (S_ISCHR (statbuf.st_mode)); + } + return test_exit_status; } |