diff options
| author | 2019-06-28 13:34:58 +0000 | |
|---|---|---|
| committer | 2019-06-28 13:34:58 +0000 | |
| commit | 3aaa63eb46949490a39db9c6d82aacc8ee5d8551 (patch) | |
| tree | ef48ea58ad350ab9d01fbfe32455a1df1fa2340c /usr.bin/ssh/serverloop.c | |
| parent | fputc/fputs return EOF on error (diff) | |
| download | wireguard-openbsd-3aaa63eb46949490a39db9c6d82aacc8ee5d8551.tar.xz wireguard-openbsd-3aaa63eb46949490a39db9c6d82aacc8ee5d8551.zip | |
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.
Diffstat (limited to 'usr.bin/ssh/serverloop.c')
| -rw-r--r-- | usr.bin/ssh/serverloop.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/ssh/serverloop.c b/usr.bin/ssh/serverloop.c index 3cd54788720..33c81feafed 100644 --- a/usr.bin/ssh/serverloop.c +++ b/usr.bin/ssh/serverloop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: serverloop.c,v 1.215 2019/03/27 09:29:14 djm Exp $ */ +/* $OpenBSD: serverloop.c,v 1.216 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 @@ -119,7 +119,7 @@ static int notify_pipe[2]; static void notify_setup(void) { - if (pipe(notify_pipe) < 0) { + if (pipe(notify_pipe) == -1) { error("pipe(notify_pipe) failed %s", strerror(errno)); } else if ((fcntl(notify_pipe[0], F_SETFD, FD_CLOEXEC) == -1) || (fcntl(notify_pipe[1], F_SETFD, FD_CLOEXEC) == -1)) { @@ -324,7 +324,7 @@ process_input(struct ssh *ssh, fd_set *readset, int connection_in) verbose("Connection closed by %.100s port %d", ssh_remote_ipaddr(ssh), ssh_remote_port(ssh)); return -1; - } else if (len < 0) { + } else if (len == -1) { if (errno != EINTR && errno != EAGAIN) { verbose("Read error from remote host " "%.100s port %d: %.100s", @@ -379,7 +379,7 @@ collect_children(struct ssh *ssh) if (child_terminated) { debug("Received SIGCHLD."); while ((pid = waitpid(-1, &status, WNOHANG)) > 0 || - (pid < 0 && errno == EINTR)) + (pid == -1 && errno == EINTR)) if (pid > 0) session_close_by_pid(ssh, pid, status); child_terminated = 0; |
