Blame SOURCES/strace-4.12-vhangup.patch

619a20
commit cb44289ee3fd1482d3b8551d2e3b4568eb57e114
619a20
Author: Dmitry V. Levin <ldv@altlinux.org>
619a20
Date:   Tue Jul 26 10:20:24 2016 +0000
619a20
619a20
    tests: fix vhangup.test
619a20
    
619a20
    * tests/vhangup.c (main): Fix expected output for the case when
619a20
    the calling process has CAP_SYS_TTY_CONFIG capability.
619a20
    
619a20
    Reported-by: Yun-Chih Chen <b03902074@ntu.edu.tw>
619a20
619a20
diff --git a/tests/vhangup.c b/tests/vhangup.c
619a20
index ba90319..468f334 100644
619a20
--- a/tests/vhangup.c
619a20
+++ b/tests/vhangup.c
619a20
@@ -13,7 +13,18 @@ main(void)
619a20
 		perror_msg_and_skip("setsid");
619a20
 
619a20
 	long rc = syscall(__NR_vhangup);
619a20
-	printf("vhangup() = %ld %s (%m)\n", rc, errno2name());
619a20
+
619a20
+	/*
619a20
+	 * On setsid() success, the new session has no controlling terminal,
619a20
+	 * therefore a subsequent vhangup() has nothing to hangup.
619a20
+	 *
619a20
+	 * The system call, however, returns 0 iff the calling process
619a20
+	 * has CAP_SYS_TTY_CONFIG capability.
619a20
+	 */
619a20
+	if (rc)
619a20
+		printf("vhangup() = %ld %s (%m)\n", rc, errno2name());
619a20
+	else
619a20
+		puts("vhangup() = 0");
619a20
 
619a20
 	puts("+++ exited with 0 +++");
619a20
 	return 0;
619a20
diff --git a/tests/vhangup.c b/tests/vhangup.c
619a20
index ba90319..468f334 100644
619a20
--- a/tests-m32/vhangup.c
619a20
+++ b/tests-m32/vhangup.c
619a20
@@ -13,7 +13,18 @@ main(void)
619a20
 		perror_msg_and_skip("setsid");
619a20
 
619a20
 	long rc = syscall(__NR_vhangup);
619a20
-	printf("vhangup() = %ld %s (%m)\n", rc, errno2name());
619a20
+
619a20
+	/*
619a20
+	 * On setsid() success, the new session has no controlling terminal,
619a20
+	 * therefore a subsequent vhangup() has nothing to hangup.
619a20
+	 *
619a20
+	 * The system call, however, returns 0 iff the calling process
619a20
+	 * has CAP_SYS_TTY_CONFIG capability.
619a20
+	 */
619a20
+	if (rc)
619a20
+		printf("vhangup() = %ld %s (%m)\n", rc, errno2name());
619a20
+	else
619a20
+		puts("vhangup() = 0");
619a20
 
619a20
 	puts("+++ exited with 0 +++");
619a20
 	return 0;