located 128+SIGPIPE error
authorgirst <girst@users.noreply.github.com>
Fri, 28 Jul 2017 21:59:47 +0000 (23:59 +0200)
committergirst <girst@users.noreply.github.com>
Fri, 28 Jul 2017 22:00:02 +0000 (00:00 +0200)
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

fag.c

diff --git a/fag.c b/fag.c
index 4f067b8878c20f1027b5225374a01f624913adbd..32fde76040ae6da2f08c35701d2900314367842b 100644 (file)
--- 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 !
Imprint / Impressum