[med-svn] [libgtextutils] 60/83: tests: don't ignore return value from write.

Charles Plessy plessy at moszumanska.debian.org
Wed Jan 8 13:37:30 UTC 2014


This is an automated email from the git hooks/post-receive script.

plessy pushed a commit to branch debian/unstable
in repository libgtextutils.

commit d95f4884b37f033968e08b9d087c717176c4bf48
Author: Assaf Gordon <assafgordon at gmail.com>
Date:   Sat Nov 9 10:36:45 2013 +0200

    tests: don't ignore return value from write.
    
    Enables compiling with "-D_FORTIFY_SOURCE=2".
    Solves github issue #1 (https://github.com/agordon/libgtextutils/issues/1).
---
 tests/test_pipe_fitter.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tests/test_pipe_fitter.c b/tests/test_pipe_fitter.c
index 29395e6..2eec87e 100644
--- a/tests/test_pipe_fitter.c
+++ b/tests/test_pipe_fitter.c
@@ -23,6 +23,7 @@
 #include <fcntl.h>
 #include <stdio.h>
 #include <string.h>
+#include <err.h>
 
 #include <gtextutils/pipe_fitter.h>
 #include "tests_assertion.h"
@@ -36,10 +37,13 @@ int main()
 	char temp[1000];
 	char str[1000];
 	int n ;
+	int i ;
 
 	//Pipe output through a GZIP program
 	fd = pipe_output_command ( "gzip", "pipe_out.txt.gz", &pid ) ;
-	write ( fd, text, strlen(text))  ;
+	i = write ( fd, text, strlen(text))  ;
+	if ( i == -1 )
+		err(1,"write failed");
 	pipe_close(fd, pid);
 
 

-- 
Alioth's /git/debian-med/git-commit-notice on /srv/git.debian.org/git/debian-med/libgtextutils.git



More information about the debian-med-commit mailing list