summaryrefslogtreecommitdiff
path: root/ssh-agent.c
diff options
context:
space:
mode:
Diffstat (limited to 'ssh-agent.c')
-rw-r--r--ssh-agent.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/ssh-agent.c b/ssh-agent.c
index eb99effd0..162760ac2 100644
--- a/ssh-agent.c
+++ b/ssh-agent.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-agent.c,v 1.135 2006/03/25 18:41:45 deraadt Exp $ */ 1/* $OpenBSD: ssh-agent.c,v 1.136 2006/03/28 01:53:43 deraadt Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1077,20 +1077,24 @@ main(int ac, char **av)
1077 1077
1078 if (ac == 0 && !c_flag && !s_flag) { 1078 if (ac == 0 && !c_flag && !s_flag) {
1079 shell = getenv("SHELL"); 1079 shell = getenv("SHELL");
1080 if (shell != NULL && strncmp(shell + strlen(shell) - 3, "csh", 3) == 0) 1080 if (shell != NULL &&
1081 strncmp(shell + strlen(shell) - 3, "csh", 3) == 0)
1081 c_flag = 1; 1082 c_flag = 1;
1082 } 1083 }
1083 if (k_flag) { 1084 if (k_flag) {
1085 const char *errstr = NULL;
1086
1084 pidstr = getenv(SSH_AGENTPID_ENV_NAME); 1087 pidstr = getenv(SSH_AGENTPID_ENV_NAME);
1085 if (pidstr == NULL) { 1088 if (pidstr == NULL) {
1086 fprintf(stderr, "%s not set, cannot kill agent\n", 1089 fprintf(stderr, "%s not set, cannot kill agent\n",
1087 SSH_AGENTPID_ENV_NAME); 1090 SSH_AGENTPID_ENV_NAME);
1088 exit(1); 1091 exit(1);
1089 } 1092 }
1090 pid = atoi(pidstr); 1093 pid = (int)strtonum(pidstr, 2, INT_MAX, &errstr);
1091 if (pid < 1) { 1094 if (errstr) {
1092 fprintf(stderr, "%s=\"%s\", which is not a good PID\n", 1095 fprintf(stderr,
1093 SSH_AGENTPID_ENV_NAME, pidstr); 1096 "%s=\"%s\", which is not a good PID: %s\n",
1097 SSH_AGENTPID_ENV_NAME, pidstr, errstr);
1094 exit(1); 1098 exit(1);
1095 } 1099 }
1096 if (kill(pid, SIGTERM) == -1) { 1100 if (kill(pid, SIGTERM) == -1) {