Both ENOEXEC and ESRCH is a kind of error that indicate successful
lookup. ENOEXEC means the server found an entry but it does not
pass filter. ESRCH means the server could not find an entry.
Hence, ENOEXEC should have more information, and should be propagated to
the caller.
}
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);