Browse Source

err: fix warn-unused-result warning in test (-O2)

/home/rusty/devel/cvs/ccan/ccan/err/test/run.c:124:2: warning: ignoring return value of ‘pipe’, declared with attribute warn_unused_result [-Wunused-result]
  pipe(pfd);

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell 9 years ago
parent
commit
1de204600b
1 changed files with 8 additions and 4 deletions
  1. 8 4
      ccan/err/test/run.c

+ 8 - 4
ccan/err/test/run.c

@@ -27,7 +27,8 @@ int main(int argc, char *argv[])
 		base = argv[0];
 
 	/* Test err() in child */
-	pipe(pfd);
+	if (pipe(pfd))
+		abort();
 	fflush(stdout);
 	if (fork()) {
 		char buffer[BUFFER_MAX+1];
@@ -59,7 +60,8 @@ int main(int argc, char *argv[])
 	}
 
 	/* Test errx() in child */
-	pipe(pfd);
+	if (pipe(pfd))
+		abort();
 	fflush(stdout);
 	if (fork()) {
 		char buffer[BUFFER_MAX+1];
@@ -89,7 +91,8 @@ int main(int argc, char *argv[])
 
 
 	/* Test warn() in child */
-	pipe(pfd);
+	if (pipe(pfd))
+		abort();
 	fflush(stdout);
 	if (fork()) {
 		char buffer[BUFFER_MAX+1];
@@ -121,7 +124,8 @@ int main(int argc, char *argv[])
 	}
 
 	/* Test warnx() in child */
-	pipe(pfd);
+	if (pipe(pfd))
+		abort();
 	fflush(stdout);
 	if (fork()) {
 		char buffer[BUFFER_MAX+1];