]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
logind-session: use RET_GATHER more 30710/head
authorMike Yuan <me@yhndnzj.com>
Wed, 3 Jan 2024 15:18:46 +0000 (23:18 +0800)
committerMike Yuan <me@yhndnzj.com>
Wed, 3 Jan 2024 15:22:58 +0000 (23:22 +0800)
src/login/logind-session.c

index 3f5decd8d9bd1a62b5ba77e9492378d49e612584..03e5d68bdfc11f3963d57b324f55d2fab7e02194 100644 (file)
@@ -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;
 }