mirror of
https://github.com/systemd/systemd.git
synced 2024-11-23 02:03:37 +08:00
core/service: service_add_fd_store() consumes passed fd
Without this change, the fd is closed twice on failure.
Fixes a bug introduced by dff9808a62
.
Fixes #35288.
This commit is contained in:
parent
f70e5620b6
commit
d99198819c
@ -3426,14 +3426,12 @@ static int service_deserialize_item(Unit *u, const char *key, const char *value,
|
||||
return 0;
|
||||
}
|
||||
|
||||
r = service_add_fd_store(s, fd, fdn, do_poll);
|
||||
r = service_add_fd_store(s, TAKE_FD(fd), fdn, do_poll);
|
||||
if (r < 0) {
|
||||
log_unit_debug_errno(u, r,
|
||||
"Failed to store deserialized fd '%s', ignoring: %m", fdn);
|
||||
return 0;
|
||||
}
|
||||
|
||||
TAKE_FD(fd);
|
||||
} else if (streq(key, "extra-fd")) {
|
||||
_cleanup_free_ char *fdv = NULL, *fdn = NULL;
|
||||
_cleanup_close_ int fd = -EBADF;
|
||||
|
Loading…
Reference in New Issue
Block a user