summaryrefslogtreecommitdiff
path: root/ssh-agent.c
diff options
context:
space:
mode:
authorderaadt@openbsd.org <deraadt@openbsd.org>2019-06-28 13:35:04 +0000
committerDamien Miller <djm@mindrot.org>2019-07-05 11:10:39 +1000
commit4d28fa78abce2890e136281950633fae2066cc29 (patch)
tree33226ec64ced661bb7e40005e30744b68fa59a80 /ssh-agent.c
parente8c974043c1648eab0ad67a7ba6a3e444fe79d2d (diff)
upstream: When system calls indicate an error they return -1, not
some arbitrary value < 0. errno is only updated in this case. Change all (most?) callers of syscalls to follow this better, and let's see if this strictness helps us in the future. OpenBSD-Commit-ID: 48081f00db7518e3b712a49dca06efc2a5428075
Diffstat (limited to 'ssh-agent.c')
-rw-r--r--ssh-agent.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/ssh-agent.c b/ssh-agent.c
index 4d7ab225f..9c6680a25 100644
--- a/ssh-agent.c
+++ b/ssh-agent.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-agent.c,v 1.236 2019/06/21 04:21:04 djm Exp $ */ 1/* $OpenBSD: ssh-agent.c,v 1.237 2019/06/28 13:35:04 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
@@ -827,11 +827,11 @@ handle_socket_read(u_int socknum)
827 827
828 slen = sizeof(sunaddr); 828 slen = sizeof(sunaddr);
829 fd = accept(sockets[socknum].fd, (struct sockaddr *)&sunaddr, &slen); 829 fd = accept(sockets[socknum].fd, (struct sockaddr *)&sunaddr, &slen);
830 if (fd < 0) { 830 if (fd == -1) {
831 error("accept from AUTH_SOCKET: %s", strerror(errno)); 831 error("accept from AUTH_SOCKET: %s", strerror(errno));
832 return -1; 832 return -1;
833 } 833 }
834 if (getpeereid(fd, &euid, &egid) < 0) { 834 if (getpeereid(fd, &euid, &egid) == -1) {
835 error("getpeereid %d failed: %s", fd, strerror(errno)); 835 error("getpeereid %d failed: %s", fd, strerror(errno));
836 close(fd); 836 close(fd);
837 return -1; 837 return -1;
@@ -1312,7 +1312,7 @@ main(int ac, char **av)
1312#ifdef HAVE_SETRLIMIT 1312#ifdef HAVE_SETRLIMIT
1313 /* deny core dumps, since memory contains unencrypted private keys */ 1313 /* deny core dumps, since memory contains unencrypted private keys */
1314 rlim.rlim_cur = rlim.rlim_max = 0; 1314 rlim.rlim_cur = rlim.rlim_max = 0;
1315 if (setrlimit(RLIMIT_CORE, &rlim) < 0) { 1315 if (setrlimit(RLIMIT_CORE, &rlim) == -1) {
1316 error("setrlimit RLIMIT_CORE: %s", strerror(errno)); 1316 error("setrlimit RLIMIT_CORE: %s", strerror(errno));
1317 cleanup_exit(1); 1317 cleanup_exit(1);
1318 } 1318 }
@@ -1345,7 +1345,7 @@ skip:
1345 if (parent_alive_interval != 0) 1345 if (parent_alive_interval != 0)
1346 check_parent_exists(); 1346 check_parent_exists();
1347 (void) reaper(); /* remove expired keys */ 1347 (void) reaper(); /* remove expired keys */
1348 if (result < 0) { 1348 if (result == -1) {
1349 if (saved_errno == EINTR) 1349 if (saved_errno == EINTR)
1350 continue; 1350 continue;
1351 fatal("poll: %s", strerror(saved_errno)); 1351 fatal("poll: %s", strerror(saved_errno));