From: girst Date: Fri, 28 Jul 2017 21:59:47 +0000 (+0200) Subject: located 128+SIGPIPE error X-Git-Url: https://git.gir.st/forkaftergrep.git/commitdiff_plain/e69d2a8e1b8ea995607f3acd398ff691014775c3 located 128+SIGPIPE error gdb output of crash: > Program received signal SIGPIPE, Broken pipe. > 0x00007ffff7b08ae0 in __write_nocancel () from /lib64/libc.so.6 > (gdb) bt > #0 0x00007ffff7b08ae0 in __write_nocancel () from /lib64/libc.so.6 > #1 0x000000000040132a in fork_after_grep (opts=...) at fag.c:190 > #2 0x0000000000400ea2 in main (argc=5, argv=0x7fffffffe128) at fag.c:83 --- diff --git a/fag.c b/fag.c index 4f067b8..32fde76 100644 --- a/fag.c +++ b/fag.c @@ -1,6 +1,6 @@ /* forkaftergrep (C) 2017 Tobias Girstmair, GPLv3 */ //TODO: if grep exits with an error, fag thinks a match was found -//TODO: sometimes fag exits with code 141 (128+SIGPIPE) +//TODO: sometimes fag exits with code 141 (128+SIGPIPE) (line 190) #define _XOPEN_SOURCE 500 #define _DEFAULT_SOURCE @@ -187,7 +187,7 @@ int fork_after_grep (struct opt opts) { write(STDERR_FILENO, buf, nbytes); } - write(grep_pipefd[1], buf, nbytes); + write(grep_pipefd[1], buf, nbytes); //TODO: sometimes gets SIGPIPE here } // TODO: exits with `0' even if `grep' exits with code > 0 !