From cccd59253314227ac74a3c926f7cc1cba8337dbe Mon Sep 17 00:00:00 2001 From: Andrey Cherepanov Date: Tue, 24 Jan 2023 17:48:25 +0300 Subject: [PATCH] Fix return code as in upstream --- ssh-agent.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/ssh-agent.c b/ssh-agent.c index 75eae926..bee7b74d 100644 --- a/ssh-agent.c +++ b/ssh-agent.c @@ -1510,16 +1510,20 @@ main(int ac, char **av) pidstr = getenv(SSH_AGENTPID_ENV_NAME); if (pidstr == NULL) { - fatal("%s not set, cannot kill agent", - SSH_AGENTPID_ENV_NAME); + fprintf(stderr, "%s not set, cannot kill agent\n", + SSH_AGENTPID_ENV_NAME); + exit(1); } pid = (int)strtonum(pidstr, 2, INT_MAX, &errstr); if (errstr) { - fatal( "%s=\"%s\", which is not a good PID: %s", - SSH_AGENTPID_ENV_NAME, pidstr, errstr); + fprintf(stderr, + "%s=\"%s\", which is not a good PID: %s\n", + SSH_AGENTPID_ENV_NAME, pidstr, errstr); + exit(1); } if (kill(pid, SIGTERM) == -1) { - fatal("kill: %m"); + perror("kill"); + exit(1); } format = c_flag ? "unsetenv %s;\n" : "unset %s;\n"; printf(format, SSH_AUTHSOCKET_ENV_NAME); @@ -1553,7 +1557,8 @@ main(int ac, char **av) /* Create private directory for agent socket */ mktemp_proto(socket_dir, sizeof(socket_dir)); if (mkdtemp(socket_dir) == NULL) { - fatal("mkdtemp: private socket dir: %m"); + perror("mkdtemp: private socket dir"); + exit(1); } snprintf(socket_name, sizeof socket_name, "%s/agent.%ld", socket_dir, (long)parent_pid); @@ -1626,10 +1631,12 @@ main(int ac, char **av) } if (setenv(SSH_AUTHSOCKET_ENV_NAME, socket_name, 1) == -1 || setenv(SSH_AGENTPID_ENV_NAME, pidstrbuf, 1) == -1) { - fatal("setenv: %m"); + perror("setenv"); + exit(1); } execvp(av[0], av); - fatal("execvp: %s: %m", av[0]); + perror(av[0]); + exit(1); } /* child */ log_init(__progname, SYSLOG_LEVEL_INFO, SYSLOG_FACILITY_AUTH, 0); -- 2.25.4