From 41935c0c3aba670d0ff7ac91a81ecff7ab7c4ae9 Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Wed, 3 Jan 2024 23:18:46 +0800 Subject: [PATCH] logind-session: use RET_GATHER more --- src/login/logind-session.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/login/logind-session.c b/src/login/logind-session.c index 3f5decd8d9b..03e5d68bdfc 100644 --- a/src/login/logind-session.c +++ b/src/login/logind-session.c @@ -377,33 +377,27 @@ static int session_load_devices(Session *s, const char *devices) { for (const char *p = devices;;) { _cleanup_free_ char *word = NULL; - SessionDevice *sd; dev_t dev; int k; k = extract_first_word(&p, &word, NULL, 0); - if (k == 0) - break; - if (k < 0) { - r = k; + if (k <= 0) { + RET_GATHER(r, k); break; } k = parse_devnum(word, &dev); if (k < 0) { - r = k; + RET_GATHER(r, k); continue; } /* The file descriptors for loaded devices will be reattached later. */ - k = session_device_new(s, dev, false, &sd); - if (k < 0) - r = k; + RET_GATHER(r, session_device_new(s, dev, /* open_device = */ false, /* ret = */ NULL)); } if (r < 0) - log_error_errno(r, "Loading session devices for session %s failed: %m", s->id); - + log_error_errno(r, "Failed to load some session devices for session '%s': %m", s->id); return r; } -- 2.47.3