diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-11-21 21:15:49 +0100 |
---|---|---|
committer | Mike Yuan <me@yhndnzj.com> | 2024-11-22 04:15:51 +0100 |
commit | d99198819caeff6f40a0a520364e59b8a0cbaa4f (patch) | |
tree | b7b62fb7e455ea32dc989ba41d6a335eccb5c2b4 /src/core/service.c | |
parent | hwdb: Add quirk for Logitech MX Keys for Mac (diff) | |
download | systemd-d99198819caeff6f40a0a520364e59b8a0cbaa4f.tar.xz systemd-d99198819caeff6f40a0a520364e59b8a0cbaa4f.zip |
core/service: service_add_fd_store() consumes passed fd
Without this change, the fd is closed twice on failure.
Fixes a bug introduced by dff9808a628c31b7ecb1f1aba8fdc3be06ce8372.
Fixes #35288.
Diffstat (limited to '')
-rw-r--r-- | src/core/service.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/core/service.c b/src/core/service.c index 5b0bb76af2..34d40c6950 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -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; |