]> granicus.if.org Git - strace/commitdiff
tests/scm_rights.c: use libtests
authorDmitry V. Levin <ldv@altlinux.org>
Mon, 4 Jan 2016 23:53:31 +0000 (23:53 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Wed, 6 Jan 2016 00:14:36 +0000 (00:14 +0000)
* tests/scm_rights.c (main): Use perror_msg_and_fail and perror_msg_and_skip.

tests/scm_rights.c

index c41444fa953e15ed78bc06447f5a44772ef0498b..1e5e850a5b03be7c6e57659512bd2b97658a063a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org>
+ * Copyright (c) 2014-2016 Dmitry V. Levin <ldv@altlinux.org>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -25,6 +25,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "tests.h"
 #include <assert.h>
 #include <string.h>
 #include <stdlib.h>
@@ -48,12 +49,15 @@ int main(int ac, const char **av)
        (void) close(3);
 
        int sv[2];
-       assert(socketpair(AF_UNIX, SOCK_STREAM, 0, sv) == 0);
+       if (socketpair(AF_UNIX, SOCK_STREAM, 0, sv))
+               perror_msg_and_skip("socketpair");
        int one = 1;
-       assert(setsockopt(sv[0], SOL_SOCKET, SO_PASSCRED, &one, sizeof(one)) == 0);
+       if (setsockopt(sv[0], SOL_SOCKET, SO_PASSCRED, &one, sizeof(one)))
+               perror_msg_and_skip("setsockopt");
 
        pid_t pid = fork();
-       assert(pid >= 0);
+       if (pid < 0)
+               perror_msg_and_fail("fork");
 
        if (pid) {
                assert(close(sv[0]) == 0);