shithub: scc

Download patch

ref: f2750859e3c3be0019fc10890baa96c41be40b68
parent: 297c3c7dfa958231abe140ee00d38b0e684ad48c
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Fri Oct 1 17:30:26 EDT 2021

tests/libc: Fix 0002-assert test

After adding the output of stderr to the comparision file
we have to consider it for the diff, and for this reason
we have to add it to the expected output.

--- a/src/libc/arch/linux/_sigaction.c
+++ b/src/libc/arch/linux/_sigaction.c
@@ -7,8 +7,7 @@
 
 int _sigaction(int sig, struct sigaction *sa, struct sigaction *old)
 {
-	int r;
-	struct sigaction ksa, kold;
+	struct sigaction ksa, *p = NULL;
 
 	if (sa) {
 		ksa.sa_handler = sa->sa_handler;
@@ -15,22 +14,11 @@
 		ksa.sa_flags = sa->sa_flags | SA_RESTORER;
 		ksa.sa_restorer = _sigreturn;
 		memcpy(&ksa.sa_mask, &sa->sa_mask, sizeof(ksa.sa_mask));
+		p = &ksa;
 	}
 
-	r = __sigaction(sig,
-	                sa ? &ksa : NULL,
-	                old ? &kold : NULL,
-	                sizeof(ksa.sa_mask));
-
-	if (r != 0)
+	if (__sigaction(sig, p, old, sizeof(ksa.sa_mask)) < 0)
 		return -1;
-
-
-	if (old) {
-		old->sa_handler = kold.sa_handler;
-		old->sa_flags = kold.sa_flags;
-		memcpy(&old->sa_mask, &kold.sa_mask, sizeof kold.sa_mask);
-	}
 
 	return 0;
 }
--- a/tests/libc/execute/0002-assert.c
+++ b/tests/libc/execute/0002-assert.c
@@ -7,6 +7,7 @@
 output:
 First assert
 Second assert, that must fail
+0002-assert.c:32: assertion failed 'sizeof(i) < sizeof(c)'
 end:
 */