summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Steves <stevesk@cvs.openbsd.org>2001-07-18 21:40:41 +0000
committerKevin Steves <stevesk@cvs.openbsd.org>2001-07-18 21:40:41 +0000
commitd830d03d9a08d95c7dd698232a0639ec8746184e (patch)
treebddf0b8f6e244fc3c2701744d244ede695f87033
parent940985ddc89fa54ebf4e1ada8c4c091fee6c32aa (diff)
chdir("/") from bbraun@synack.net; ok markus@
-rw-r--r--usr.bin/ssh/ssh-agent.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/usr.bin/ssh/ssh-agent.c b/usr.bin/ssh/ssh-agent.c
index 2b20bb5f5ba..e42b0005380 100644
--- a/usr.bin/ssh/ssh-agent.c
+++ b/usr.bin/ssh/ssh-agent.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-agent.c,v 1.66 2001/07/17 20:48:42 markus Exp $ */
+/* $OpenBSD: ssh-agent.c,v 1.67 2001/07/18 21:40:40 stevesk Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -36,7 +36,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: ssh-agent.c,v 1.66 2001/07/17 20:48:42 markus Exp $");
+RCSID("$OpenBSD: ssh-agent.c,v 1.67 2001/07/18 21:40:40 stevesk Exp $");
#include <openssl/evp.h>
#include <openssl/md5.h>
@@ -961,6 +961,13 @@ main(int ac, char **av)
perror(av[0]);
exit(1);
}
+
+ if (setsid() == -1) {
+ perror("setsid");
+ cleanup_exit(1);
+ }
+
+ (void)chdir("/");
close(0);
close(1);
close(2);
@@ -971,10 +978,6 @@ main(int ac, char **av)
perror("setrlimit rlimit_core failed");
cleanup_exit(1);
}
- if (setsid() == -1) {
- perror("setsid");
- cleanup_exit(1);
- }
skip:
if (atexit(cleanup_socket) < 0) {