From: Dmitry V. Levin Date: Sun, 6 Dec 2015 01:02:17 +0000 (+0000) Subject: inet-cmsg.test: skip the test when the network is not functional X-Git-Tag: v4.11~57 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=02d92d095c1387b9fed56755f714a2d82273112e;p=strace inet-cmsg.test: skip the test when the network is not functional * tests/inet-cmsg.c (main): Return 77 if inet datagram socket cannot be bound to INADDR_LOOPBACK. --- diff --git a/tests/inet-cmsg.c b/tests/inet-cmsg.c index bfc80755..85ddfdac 100644 --- a/tests/inet-cmsg.c +++ b/tests/inet-cmsg.c @@ -103,7 +103,10 @@ main(void) .sin_addr.s_addr = htonl(INADDR_LOOPBACK) }; socklen_t len = sizeof(addr); - assert(!bind(0, (struct sockaddr *) &addr, len)); + if (bind(0, (struct sockaddr *) &addr, len)) { + perror("bind"); + return 77; + } assert(!getsockname(0, (struct sockaddr *) &addr, &len)); assert(socket(PF_INET, SOCK_DGRAM, 0) == 3);