tests: improve setugid error diagnostics a bit

* tests/setugid.c (main): Print unexpected code returned by syscall.
This commit is contained in:
Eugene Syromyatnikov 2018-01-19 03:24:03 +01:00 committed by Dmitry V. Levin
parent 457ad95b7f
commit b3d691efe4

View File

@ -61,6 +61,8 @@ main(void)
const unsigned int num = (unsigned UGID_TYPE) tests[i]; const unsigned int num = (unsigned UGID_TYPE) tests[i];
long expected; long expected;
errno = 0;
if (num == ugid) if (num == ugid)
expected = 0; expected = 0;
else if ((UGID_TYPE) num == (UGID_TYPE) -1U) else if ((UGID_TYPE) num == (UGID_TYPE) -1U)
@ -77,8 +79,9 @@ main(void)
SYSCALL_NAME, ugid, errstr); SYSCALL_NAME, ugid, errstr);
break; break;
} }
perror_msg_and_fail("%s(%#lx) != %ld", perror_msg_and_fail("%s(%#lx) = %ld != %ld",
SYSCALL_NAME, tests[i], expected); SYSCALL_NAME, tests[i],
rc, expected);
} }
printf("%s(", SYSCALL_NAME); printf("%s(", SYSCALL_NAME);