aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tsh.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/tsh.cc b/tsh.cc
index 72263e0..9253c8f 100644
--- a/tsh.cc
+++ b/tsh.cc
@@ -485,11 +485,17 @@ void sigchld_handler(int sig)
*/
void sigint_handler(int sig)
{
+ int errno_backup = errno;
+
+
int pid = fgpid(jobs);
if (pid != 0)
{
kill(-pid, SIGINT);
}
+
+
+ errno = errno_backup;
return;
}
@@ -500,11 +506,17 @@ void sigint_handler(int sig)
*/
void sigtstp_handler(int sig)
{
+ int errno_backup = errno;
+
+
int pid = fgpid(jobs);
if (pid != 0)
{
kill(-pid, SIGTSTP);
}
+
+
+ errno = errno_backup;
return;
}