From: Dmitry V. Levin Date: Mon, 12 Sep 2016 09:27:58 +0000 (+0000) Subject: tests: use sprintrc_grep in tests/ipc_sem.c X-Git-Tag: v4.14~84 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3138893026bfdeb4880e2129b1c44258164f382b;p=strace tests: use sprintrc_grep in tests/ipc_sem.c * tests/ipc_sem.c (main): Use sprintrc_grep. --- diff --git a/tests/ipc_sem.c b/tests/ipc_sem.c index 98753f3c..01445e5b 100644 --- a/tests/ipc_sem.c +++ b/tests/ipc_sem.c @@ -73,27 +73,14 @@ main(void) id, &ds); un.__buf = &info; - int max = semctl(0, 0, SEM_INFO, un); - if (max < 0) - perror_msg_and_skip("semctl SEM_INFO"); - printf("semctl\\(0, 0, (IPC_64\\|)?SEM_INFO, \\[?%p\\]?\\) += %d\n", - &info, max); + rc = semctl(0, 0, SEM_INFO, un); + printf("semctl\\(0, 0, (IPC_64\\|)?SEM_INFO, \\[?%p\\]?\\) += %s\n", + &info, sprintrc_grep(rc)); un.buf = &ds; rc = semctl(id, 0, SEM_STAT, un); - if (rc != id) { - /* - * In linux < v2.6.24-rc1 the first argument must be - * an index in the kernel's internal array. - */ - if (-1 != rc || EINVAL != errno) - perror_msg_and_skip("semctl SEM_STAT"); - printf("semctl\\(%d, 0, (IPC_64\\|)?SEM_STAT, \\[?%p\\]?\\)" - " += -1 EINVAL \\(%m\\)\n", id, &ds); - } else { - printf("semctl\\(%d, 0, (IPC_64\\|)?SEM_STAT, \\[?%p\\]?\\)" - " += %d\n", id, &ds, id); - } + printf("semctl\\(%d, 0, (IPC_64\\|)?SEM_STAT, \\[?%p\\]?\\) += %s\n", + id, &ds, sprintrc_grep(rc)); return 0; }