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:35 +0200
committerJörg Frings-Fürst <debian@jff.email>2025-10-18 19:07:35 +0200
commitfa23d938c040bc8af305a31fa874df55b2a02576 (patch)
tree9704e2f7bd8962ea8911cd6f4e2d37227d7eff2e /tests/test-fstat.c
parentdf9dbf9b0915e432a4a2c4182f60af36374eaaab (diff)
parent693ae7b71dfdd1a8146266b5794a71c0dbe5dff0 (diff)
Merge branch 'feature/upstream' into develop
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;
}