diff --git a/src/shared/userdb.c b/src/shared/userdb.c index a5c72cfa5d..2238073e01 100644 --- a/src/shared/userdb.c +++ b/src/shared/userdb.c @@ -427,9 +427,12 @@ static int userdb_on_query_reply( } finish: - /* If we got one ESRCH or ENOEXEC, let that win. This way when we do a wild dump we won't be tripped - * up by bad errors – as long as at least one connection ended somewhat cleanly */ - if (IN_SET(r, -ESRCH, -ENOEXEC) || iterator->error == 0) + /* If we got one ENOEXEC, let that win. Similarly, ESRCH wins except for ENOEXEC. This way when we do + * a wild dump we won't be tripped up by bad errors – as long as at least one connection ended + * somewhat cleanly. */ + if (r == -ENOEXEC || + (r == -ESRCH && iterator->error != ENOEXEC) || + iterator->error == 0) iterator->error = -r; assert_se(set_remove(iterator->links, link) == link);