Skip to content

Commit d95f488

Browse files
committed
tests: don't ignore return value from write.
Enables compiling with "-D_FORTIFY_SOURCE=2". Solves github issue #1 (#1).
1 parent dc6863f commit d95f488

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

tests/test_pipe_fitter.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <fcntl.h>
2424
#include <stdio.h>
2525
#include <string.h>
26+
#include <err.h>
2627

2728
#include <gtextutils/pipe_fitter.h>
2829
#include "tests_assertion.h"
@@ -36,10 +37,13 @@ int main()
3637
char temp[1000];
3738
char str[1000];
3839
int n ;
40+
int i ;
3941

4042
//Pipe output through a GZIP program
4143
fd = pipe_output_command ( "gzip", "pipe_out.txt.gz", &pid ) ;
42-
write ( fd, text, strlen(text)) ;
44+
i = write ( fd, text, strlen(text)) ;
45+
if ( i == -1 )
46+
err(1,"write failed");
4347
pipe_close(fd, pid);
4448

4549

0 commit comments

Comments
 (0)