1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-31 07:51:21 +03:00

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.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2021-07-06 16:41:28 +02:00 committed by Luca Boccassi
parent 48e5ef14af
commit b4b0f87c62

View File

@ -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)