summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Guenthe <guenther@cvs.openbsd.org>2010-01-15 00:05:23 +0000
committerPhilip Guenthe <guenther@cvs.openbsd.org>2010-01-15 00:05:23 +0000
commit4ab439a0e7dbb542d6fc5938fe54bd7ab3f63186 (patch)
treec9077693308105a45fef6c031386d65e6a4f0415
parent5b1f64672ecfd5487706902846d0b1bc2a358357 (diff)
Reset SIGTERM to SIG_DFL before executing ssh, so that even if sftp
inherited SIGTERM as ignored it will still be able to kill the ssh it starts. ok dtucker@
-rw-r--r--usr.bin/ssh/sftp.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/ssh/sftp.c b/usr.bin/ssh/sftp.c
index fa0485c674c..3309a816dd3 100644
--- a/usr.bin/ssh/sftp.c
+++ b/usr.bin/ssh/sftp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sftp.c,v 1.121 2010/01/13 12:48:34 jmc Exp $ */
+/* $OpenBSD: sftp.c,v 1.122 2010/01/15 00:05:22 guenther Exp $ */
/*
* Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
*
@@ -1979,9 +1979,11 @@ connect_to_server(char *path, char **args, int *in, int *out)
* The underlying ssh is in the same process group, so we must
* ignore SIGINT if we want to gracefully abort commands,
* otherwise the signal will make it to the ssh process and
- * kill it too
+ * kill it too. Contrawise, since sftp sends SIGTERMs to the
+ * underlying ssh, it must *not* ignore that signal.
*/
signal(SIGINT, SIG_IGN);
+ signal(SIGTERM, SIG_DFL);
execvp(path, args);
fprintf(stderr, "exec: %s: %s\n", path, strerror(errno));
_exit(1);