summaryrefslogtreecommitdiff
path: root/tests/test-fstat.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2025-10-18 19:06:52 +0200
committerJörg Frings-Fürst <debian@jff.email>2025-10-18 19:06:52 +0200
commit27dae84ed92f1ef0300263091972338d12e78348 (patch)
tree7c52931f474fafb8a4bd4fd15ca3461c77cdecc2 /tests/test-fstat.c
parent4682deeb62247d34de87f8e777f99e2d337fd377 (diff)
New upstream version 1.4.1upstream/1.4.1upstream
Diffstat (limited to 'tests/test-fstat.c')
-rw-r--r--tests/test-fstat.c15
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;
}