From: Mike Yuan Date: Wed, 3 Jan 2024 15:18:46 +0000 (+0800) Subject: logind-session: use RET_GATHER more X-Git-Tag: v256-rc1~1323^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=41935c0c3aba670d0ff7ac91a81ecff7ab7c4ae9;p=thirdparty%2Fsystemd.git logind-session: use RET_GATHER more --- 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; }