test: return a non-zero return code when 'nobody' user doesn't exist

Lookup of a non-existing user using getpwnam() is not considered
an error, thus the `errno` is not set appropriately, causing
unexpected fails on systems, where 'nobody' user doesn't exist by
default
This commit is contained in:
Frantisek Sumsal 2019-05-06 10:48:12 +02:00 committed by Zbigniew Jędrzejewski-Szmek
parent c26f3b1c86
commit 6ab668337e

View file

@ -99,7 +99,7 @@ static int setup_tests(bool *run_ambient) {
nobody = getpwnam(NOBODY_USER_NAME);
if (!nobody)
return log_error_errno(errno, "Could not find nobody user: %m");
return log_error_errno(SYNTHETIC_ERRNO(ENOENT), "Could not find nobody user: %m");
test_uid = nobody->pw_uid;
test_gid = nobody->pw_gid;