Skip to content

Commit b4b0f87

Browse files
keszybzbluca
authored andcommitted
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 systemd#20140. Also three other similar cases are updated.
1 parent 48e5ef1 commit b4b0f87

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/tmpfiles/tmpfiles.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,7 @@ static int fd_set_perms(Item *i, int fd, const char *path, const struct stat *st
883883
int r;
884884

885885
assert(i);
886-
assert(fd);
886+
assert(fd >= 0);
887887
assert(path);
888888

889889
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
10671067
char **name, **value;
10681068

10691069
assert(i);
1070-
assert(fd);
1070+
assert(fd >= 0);
10711071
assert(path);
10721072

10731073
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 *
11701170
struct stat stbuf;
11711171

11721172
assert(item);
1173-
assert(fd);
1173+
assert(fd >= 0);
11741174
assert(path);
11751175

11761176
if (!st) {
@@ -1324,7 +1324,7 @@ static int fd_set_attribute(Item *item, int fd, const char *path, const struct s
13241324
int r;
13251325

13261326
assert(item);
1327-
assert(fd);
1327+
assert(fd >= 0);
13281328
assert(path);
13291329

13301330
if (!item->attribute_set || item->attribute_mask == 0)

0 commit comments

Comments
 (0)