From: Dmitry V. Levin Date: Wed, 6 Jan 2016 11:35:23 +0000 (+0000) Subject: tests/signalfd.c: use libtests X-Git-Tag: v4.12~701 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0b7532091099b7ff1df501b4713567ee25294c63;p=strace tests/signalfd.c: use libtests * tests/signalfd.c: Use SKIP_MAIN_UNDEFINED. (main): Use perror_msg_and_skip. --- diff --git a/tests/signalfd.c b/tests/signalfd.c index 23833a69..7b1d6ce2 100644 --- a/tests/signalfd.c +++ b/tests/signalfd.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Dmitry V. Levin + * Copyright (c) 2015-2016 Dmitry V. Levin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,24 +27,28 @@ #include "tests.h" #include -#include -#include -#ifdef HAVE_SYS_SIGNALFD_H + +#if defined HAVE_SYS_SIGNALFD_H && defined HAVE_SIGNALFD && defined O_CLOEXEC + +# include +# include # include -#endif int main(void) { -#if defined HAVE_SYS_SIGNALFD_H && defined HAVE_SIGNALFD && defined O_CLOEXEC sigset_t mask; sigemptyset(&mask); sigaddset(&mask, SIGUSR2); sigaddset(&mask, SIGCHLD); (void) close(0); - return signalfd(-1, &mask, O_CLOEXEC | O_NONBLOCK) == 0 ? - 0 : 77; + if (signalfd(-1, &mask, O_CLOEXEC | O_NONBLOCK)) + perror_msg_and_skip("signalfd"); + return 0; +} + #else - return 77; + +SKIP_MAIN_UNDEFINED("HAVE_SYS_SIGNALFD_H && HAVE_SIGNALFD && O_CLOEXEC") + #endif -}