aboutsummaryrefslogtreecommitdiffstats
path: root/builtin.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2016-05-12 21:43:48 +0300
committerArnold D. Robbins <arnold@skeeve.com>2016-05-12 21:43:48 +0300
commitb2b81414cc6f4c2c4b5539a680c074c8c4592af7 (patch)
tree2061a3559e8e878d875a0135ac7ebae89448caa9 /builtin.c
parentfec6265dfb087ecc8a26a9d8917bcd05bb4b1860 (diff)
downloadegawk-b2b81414cc6f4c2c4b5539a680c074c8c4592af7.tar.gz
egawk-b2b81414cc6f4c2c4b5539a680c074c8c4592af7.tar.bz2
egawk-b2b81414cc6f4c2c4b5539a680c074c8c4592af7.zip
Fix issues with SIGPIPE.
Diffstat (limited to 'builtin.c')
-rw-r--r--builtin.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/builtin.c b/builtin.c
index d7101c26..fb67af4c 100644
--- a/builtin.c
+++ b/builtin.c
@@ -2092,6 +2092,10 @@ do_system(int nargs)
cmd[tmp->stlen] = '\0';
os_restore_mode(fileno(stdin));
+#ifdef SIGPIPE
+ signal(SIGPIPE, SIG_DFL);
+#endif
+
status = system(cmd);
/*
* 3/2016. What to do with ret? It's never simple.
@@ -2123,8 +2127,12 @@ do_system(int nargs)
} else
ret = 0; /* shouldn't get here */
}
+
if ((BINMODE & BINMODE_INPUT) != 0)
os_setbinmode(fileno(stdin), O_BINARY);
+#ifdef SIGPIPE
+ signal(SIGPIPE, SIG_IGN);
+#endif
cmd[tmp->stlen] = save;
}