blob: 3fbab8b66fd92628df780d75ce256b5ef5ddbd7e [file] [log] [blame]
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05001From 339a15b619b479c63cafba21d5fc359e613d9ee8 Mon Sep 17 00:00:00 2001
2From: "Dmitry V. Levin" <ldv@altlinux.org>
3Date: Mon, 4 Jan 2016 23:53:31 +0000
4Subject: [PATCH] tests/scm_rights.c: use libtests
5
6* tests/scm_rights.c (main): Use perror_msg_and_fail and perror_msg_and_skip.
7---
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9Upstream-Status: Backport
10
11 tests/scm_rights.c | 12 ++++++++----
12 1 file changed, 8 insertions(+), 4 deletions(-)
13
14diff --git a/tests/scm_rights.c b/tests/scm_rights.c
15index c41444f..1e5e850 100644
16--- a/tests/scm_rights.c
17+++ b/tests/scm_rights.c
18@@ -1,5 +1,5 @@
19 /*
20- * Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org>
21+ * Copyright (c) 2014-2016 Dmitry V. Levin <ldv@altlinux.org>
22 * All rights reserved.
23 *
24 * Redistribution and use in source and binary forms, with or without
25@@ -25,6 +25,7 @@
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29+#include "tests.h"
30 #include <assert.h>
31 #include <string.h>
32 #include <stdlib.h>
33@@ -48,12 +49,15 @@ int main(int ac, const char **av)
34 (void) close(3);
35
36 int sv[2];
37- assert(socketpair(AF_UNIX, SOCK_STREAM, 0, sv) == 0);
38+ if (socketpair(AF_UNIX, SOCK_STREAM, 0, sv))
39+ perror_msg_and_skip("socketpair");
40 int one = 1;
41- assert(setsockopt(sv[0], SOL_SOCKET, SO_PASSCRED, &one, sizeof(one)) == 0);
42+ if (setsockopt(sv[0], SOL_SOCKET, SO_PASSCRED, &one, sizeof(one)))
43+ perror_msg_and_skip("setsockopt");
44
45 pid_t pid = fork();
46- assert(pid >= 0);
47+ if (pid < 0)
48+ perror_msg_and_fail("fork");
49
50 if (pid) {
51 assert(close(sv[0]) == 0);
52--
531.9.1
54