summaryrefslogtreecommitdiffstats
path: root/ssh-agent.c
diff options
context:
space:
mode:
authorderaadt@openbsd.org <deraadt@openbsd.org>2019-06-28 15:35:04 +0200
committerDamien Miller <djm@mindrot.org>2019-07-05 03:10:39 +0200
commit4d28fa78abce2890e136281950633fae2066cc29 (patch)
tree33226ec64ced661bb7e40005e30744b68fa59a80 /ssh-agent.c
parentupstream: asprintf returns -1, not an arbitrary value < 0. Also (diff)
downloadopenssh-4d28fa78abce2890e136281950633fae2066cc29.tar.xz
openssh-4d28fa78abce2890e136281950633fae2066cc29.zip
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 @@
-/* $OpenBSD: ssh-agent.c,v 1.236 2019/06/21 04:21:04 djm Exp $ */
+/* $OpenBSD: ssh-agent.c,v 1.237 2019/06/28 13:35:04 deraadt Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -827,11 +827,11 @@ handle_socket_read(u_int socknum)
slen = sizeof(sunaddr);
fd = accept(sockets[socknum].fd, (struct sockaddr *)&sunaddr, &slen);
- if (fd < 0) {
+ if (fd == -1) {
error("accept from AUTH_SOCKET: %s", strerror(errno));
return -1;
}
- if (getpeereid(fd, &euid, &egid) < 0) {
+ if (getpeereid(fd, &euid, &egid) == -1) {
error("getpeereid %d failed: %s", fd, strerror(errno));
close(fd);
return -1;
@@ -1312,7 +1312,7 @@ main(int ac, char **av)
#ifdef HAVE_SETRLIMIT
/* deny core dumps, since memory contains unencrypted private keys */
rlim.rlim_cur = rlim.rlim_max = 0;
- if (setrlimit(RLIMIT_CORE, &rlim) < 0) {
+ if (setrlimit(RLIMIT_CORE, &rlim) == -1) {
error("setrlimit RLIMIT_CORE: %s", strerror(errno));
cleanup_exit(1);
}
@@ -1345,7 +1345,7 @@ skip:
if (parent_alive_interval != 0)
check_parent_exists();
(void) reaper(); /* remove expired keys */
- if (result < 0) {
+ if (result == -1) {
if (saved_errno == EINTR)
continue;
fatal("poll: %s", strerror(saved_errno));