diff options
author | deraadt@openbsd.org <deraadt@openbsd.org> | 2019-06-28 13:35:04 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2019-07-05 11:10:39 +1000 |
commit | 4d28fa78abce2890e136281950633fae2066cc29 (patch) | |
tree | 33226ec64ced661bb7e40005e30744b68fa59a80 /authfd.c | |
parent | e8c974043c1648eab0ad67a7ba6a3e444fe79d2d (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 'authfd.c')
-rw-r--r-- | authfd.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: authfd.c,v 1.114 2019/06/21 04:21:04 djm Exp $ */ | 1 | /* $OpenBSD: authfd.c,v 1.115 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 |
@@ -101,12 +101,12 @@ ssh_get_authentication_socket(int *fdp) | |||
101 | sunaddr.sun_family = AF_UNIX; | 101 | sunaddr.sun_family = AF_UNIX; |
102 | strlcpy(sunaddr.sun_path, authsocket, sizeof(sunaddr.sun_path)); | 102 | strlcpy(sunaddr.sun_path, authsocket, sizeof(sunaddr.sun_path)); |
103 | 103 | ||
104 | if ((sock = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) | 104 | if ((sock = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) |
105 | return SSH_ERR_SYSTEM_ERROR; | 105 | return SSH_ERR_SYSTEM_ERROR; |
106 | 106 | ||
107 | /* close on exec */ | 107 | /* close on exec */ |
108 | if (fcntl(sock, F_SETFD, FD_CLOEXEC) == -1 || | 108 | if (fcntl(sock, F_SETFD, FD_CLOEXEC) == -1 || |
109 | connect(sock, (struct sockaddr *)&sunaddr, sizeof(sunaddr)) < 0) { | 109 | connect(sock, (struct sockaddr *)&sunaddr, sizeof(sunaddr)) == -1) { |
110 | oerrno = errno; | 110 | oerrno = errno; |
111 | close(sock); | 111 | close(sock); |
112 | errno = oerrno; | 112 | errno = oerrno; |