tests/umode_t.c: guard against libc printf format errors

* tests/umode_t.c (test_syscall): Use different printf format specifiers
to detect libc printf format errors.
This commit is contained in:
Дмитрий Левин 2016-08-04 12:06:18 +00:00
parent f4001a3d12
commit 08601fdc68

View File

@ -47,8 +47,14 @@ test_syscall(unsigned short mode)
long rc = syscall(TEST_SYSCALL_NR, TEST_SYSCALL_PREFIX_ARGS
sample, lmode);
printf("%s(%s\"%s\", %#03ho) = %ld %s (%m)\n",
sample, TEST_SYSCALL_PREFIX_STR, sample, mode, rc, errno2name());
if (mode <= 07)
printf("%s(%s\"%s\", 00%d) = %ld %s (%m)\n",
sample, TEST_SYSCALL_PREFIX_STR,
sample, (int) mode, rc, errno2name());
else
printf("%s(%s\"%s\", %#03ho) = %ld %s (%m)\n",
sample, TEST_SYSCALL_PREFIX_STR,
sample, mode, rc, errno2name());
}
int