summaryrefslogtreecommitdiff
path: root/src/core/smack-setup.c
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2019-09-29 13:43:00 +0200
committerChris Down <chris@chrisdown.name>2019-09-30 13:29:59 +0100
commit28e68bb23547cbc11cd3f62a1a38dbe2b387b370 (patch)
tree29fa75170fab7bf9e81d0e1e475348a076c0c794 /src/core/smack-setup.c
parent501deda1ce89bb558936741c1aeb244e264e8af1 (diff)
downloadsystemd-28e68bb23547cbc11cd3f62a1a38dbe2b387b370.tar.gz
Handle d_type == DT_UNKNOWN correctly
As documented in the man-page, readdir() may return a directory entry with d_type == DT_UNKNOWN. This must be handled for regular filesystems. dirent_ensure_type() is available to set d_type if necessary. Use it in some more places. Without this systemd will fail to boot correctly with nfsroot and some other filesystems. Closes #13609
Diffstat (limited to 'src/core/smack-setup.c')
-rw-r--r--src/core/smack-setup.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/core/smack-setup.c b/src/core/smack-setup.c
index b95e6239d4..e2d4c0d6e1 100644
--- a/src/core/smack-setup.c
+++ b/src/core/smack-setup.c
@@ -84,6 +84,7 @@ static int write_access2_rules(const char *srcdir) {
FOREACH_DIRENT(entry, dir, return 0) {
_cleanup_fclose_ FILE *policy = NULL;
+ dirent_ensure_type(dir, entry);
if (!dirent_is_file(entry))
continue;
@@ -150,6 +151,7 @@ static int write_cipso2_rules(const char *srcdir) {
FOREACH_DIRENT(entry, dir, return 0) {
_cleanup_fclose_ FILE *policy = NULL;
+ dirent_ensure_type(dir, entry);
if (!dirent_is_file(entry))
continue;