From: Zbigniew Jędrzejewski-Szmek Date: Tue, 6 Jul 2021 14:41:28 +0000 (+0200) Subject: tmpfiles: fix borked assert X-Git-Tag: v249~10 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b4b0f87c6275dde32769c2e75231caa1d4c21f9b;p=thirdparty%2Fsystemd.git tmpfiles: fix borked assert It seems that fd_set_perms() is always called after checking that fd >= 0 (also when called as action() in glob_item_recursively()), so it seems that the assertion really came from fd==0. Fixes #20140. Also three other similar cases are updated. --- diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index 9ffe7847958..7e85c506348 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -883,7 +883,7 @@ static int fd_set_perms(Item *i, int fd, const char *path, const struct stat *st int r; assert(i); - assert(fd); + assert(fd >= 0); assert(path); if (!i->mode_set && !i->uid_set && !i->gid_set) @@ -1067,7 +1067,7 @@ static int fd_set_xattrs(Item *i, int fd, const char *path, const struct stat *s char **name, **value; assert(i); - assert(fd); + assert(fd >= 0); assert(path); xsprintf(procfs_path, "/proc/self/fd/%i", fd); @@ -1170,7 +1170,7 @@ static int fd_set_acls(Item *item, int fd, const char *path, const struct stat * struct stat stbuf; assert(item); - assert(fd); + assert(fd >= 0); assert(path); if (!st) { @@ -1324,7 +1324,7 @@ static int fd_set_attribute(Item *item, int fd, const char *path, const struct s int r; assert(item); - assert(fd); + assert(fd >= 0); assert(path); if (!item->attribute_set || item->attribute_mask == 0)