summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-07-06 16:41:28 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-07-12 13:30:55 +0200
commit1dcecfc50b6c4db3b76b81765403f84c06ecf225 (patch)
tree8d472d1bcf16967bcada0f167d8eb8eff60978d2
parent0a7492cfa7287c1272caa3d7733c3c4d569c2a15 (diff)
downloadsystemd-1dcecfc50b6c4db3b76b81765403f84c06ecf225.tar.gz
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. (cherry picked from commit b4b0f87c6275dde32769c2e75231caa1d4c21f9b)
-rw-r--r--src/tmpfiles/tmpfiles.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index f741ac0ec6..e865187bd1 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -840,7 +840,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)
@@ -1024,7 +1024,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);
@@ -1127,7 +1127,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) {
@@ -1281,7 +1281,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)