diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-08-15 20:05:32 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-08-16 21:49:04 +0900 |
commit | 2720b6f23cbf87235339dd3cec32ab790f1b5bf5 (patch) | |
tree | 344f919fa6b2347620f4c25cdb443c862f26a1ac /src/login/logind.c | |
parent | 50e23ac6671ea1eb00cde2a2bd1ee5ee69895f3b (diff) | |
download | systemd-2720b6f23cbf87235339dd3cec32ab790f1b5bf5.tar.gz |
login: use helper functions for fd store
Diffstat (limited to 'src/login/logind.c')
-rw-r--r-- | src/login/logind.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/login/logind.c b/src/login/logind.c index d14a17274b..3a6a6e0748 100644 --- a/src/login/logind.c +++ b/src/login/logind.c @@ -438,7 +438,7 @@ static int deliver_fd(Manager *m, const char *fdname, int fd) { static int manager_attach_fds(Manager *m) { _cleanup_strv_free_ char **fdnames = NULL; - int r, n; + int n; /* Upon restart, PID1 will send us back all fds of session devices that we previously opened. Each * file descriptor is associated with a given session. The session ids are passed through FDNAMES. */ @@ -455,15 +455,9 @@ static int manager_attach_fds(Manager *m) { if (deliver_fd(m, fdnames[i], fd) >= 0) continue; - /* Hmm, we couldn't deliver the fd to any session device object? If so, let's close the fd */ - safe_close(fd); - - /* Remove from fdstore as well */ - r = sd_notifyf(false, - "FDSTOREREMOVE=1\n" - "FDNAME=%s", fdnames[i]); - if (r < 0) - log_warning_errno(r, "Failed to remove file descriptor from the store, ignoring: %m"); + /* Hmm, we couldn't deliver the fd to any session device object? If so, let's close the fd + * and remove it from fdstore. */ + close_and_notify_warn(fd, fdnames[i]); } return 0; |