]> granicus.if.org Git - strace/commitdiff
tests/timer_create.c: robustify against os specific issues
authorDmitry V. Levin <ldv@altlinux.org>
Tue, 17 May 2016 17:18:48 +0000 (17:18 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Wed, 18 May 2016 09:26:01 +0000 (09:26 +0000)
* tests/timer_create.c (main): Do not assume any specific error code
returned by timer_create, print whatever it is.

tests/timer_create.c

index 8f7d5cd88eae85743a3f03538d7e7a393948b242..ff924d3f83ffbf29578a45a41f1b4c6cc6467742 100644 (file)
@@ -42,7 +42,8 @@ int
 main(void)
 {
        syscall(__NR_timer_create, CLOCK_REALTIME, NULL, NULL);
-       printf("timer_create(CLOCK_REALTIME, NULL, NULL) = -1 EFAULT (%m)\n");
+       printf("timer_create(CLOCK_REALTIME, NULL, NULL) = -1 %s (%m)\n",
+              errno2name());
 
        int tid[4] = {};
        struct_sigevent sev = {
@@ -54,10 +55,11 @@ main(void)
        syscall(__NR_timer_create, CLOCK_REALTIME, &sev, NULL);
        printf("timer_create(CLOCK_REALTIME, {sigev_value={int=%d, ptr=%#lx}"
               ", sigev_signo=%u, sigev_notify=%#x /* SIGEV_??? */}"
-              ", NULL) = -1 EINVAL (%m)\n",
+              ", NULL) = -1 %s (%m)\n",
               sev.sigev_value.sival_int,
               sev.sigev_value.sival_ptr,
-              sev.sigev_signo, sev.sigev_notify);
+              sev.sigev_signo, sev.sigev_notify,
+              errno2name());
 
        sev.sigev_notify = SIGEV_NONE;
        if (syscall(__NR_timer_create, CLOCK_REALTIME, &sev, &tid[0]))