]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
userdb: remove unnecesary repeated if check
authorLennart Poettering <lennart@poettering.net>
Fri, 30 Apr 2021 21:08:55 +0000 (23:08 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 7 May 2021 10:11:42 +0000 (12:11 +0200)
(cherry picked from commit 77fe7d15931cc17c933ae8778c4161112783dc79)

src/shared/userdb.c

index e188123e2e190100d82c01179dbb487747a3638f..149a8e1a0ea8580edc46f872bc43eb6c0cec9790 100644 (file)
@@ -776,11 +776,11 @@ int userdb_iterator_get(UserDBIterator *iterator, UserRecord **ret) {
                         iterator->n_found++;
                         return synthetic_nobody_user_build(ret);
                 }
-        }
 
-        /* if we found at least one entry, then ignore errors and indicate that we reached the end */
-        if (r < 0 && iterator->n_found > 0)
-                return -ESRCH;
+                /* if we found at least one entry, then ignore errors and indicate that we reached the end */
+                if (iterator->n_found > 0)
+                        return -ESRCH;
+        }
 
         return r;
 }
@@ -975,11 +975,11 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
                         iterator->n_found++;
                         return synthetic_nobody_group_build(ret);
                 }
-        }
 
-        /* if we found at least one entry, then ignore errors and indicate that we reached the end */
-        if (r < 0 && iterator->n_found > 0)
-                return -ESRCH;
+                /* if we found at least one entry, then ignore errors and indicate that we reached the end */
+                if (iterator->n_found > 0)
+                        return -ESRCH;
+        }
 
         return r;
 }