summaryrefslogtreecommitdiff
path: root/tests/test-fstat.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2025-10-18 19:07:08 +0200
committerJörg Frings-Fürst <debian@jff.email>2025-10-18 19:07:08 +0200
commit693ae7b71dfdd1a8146266b5794a71c0dbe5dff0 (patch)
tree9704e2f7bd8962ea8911cd6f4e2d37227d7eff2e /tests/test-fstat.c
parentb8b9b0ac61ac47dddc58717f23619f8b06640498 (diff)
parent27dae84ed92f1ef0300263091972338d12e78348 (diff)
Update upstream source from tag 'upstream/1.4.1'
Update to upstream version '1.4.1' with Debian dir 8add41ffbfe3e6636eec0ec134c5af96832cc143
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;
}