From 4d28fa78abce2890e136281950633fae2066cc29 Mon Sep 17 00:00:00 2001 From: "deraadt@openbsd.org" Date: Fri, 28 Jun 2019 13:35:04 +0000 Subject: 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 --- readpass.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'readpass.c') diff --git a/readpass.c b/readpass.c index 44014ef8a..7e52cae9c 100644 --- a/readpass.c +++ b/readpass.c @@ -1,4 +1,4 @@ -/* $OpenBSD: readpass.c,v 1.53 2019/01/19 04:15:56 tb Exp $ */ +/* $OpenBSD: readpass.c,v 1.54 2019/06/28 13:35:04 deraadt Exp $ */ /* * Copyright (c) 2001 Markus Friedl. All rights reserved. * @@ -61,19 +61,19 @@ ssh_askpass(char *askpass, const char *msg) error("ssh_askpass: fflush: %s", strerror(errno)); if (askpass == NULL) fatal("internal error: askpass undefined"); - if (pipe(p) < 0) { + if (pipe(p) == -1) { error("ssh_askpass: pipe: %s", strerror(errno)); return NULL; } osigchld = signal(SIGCHLD, SIG_DFL); - if ((pid = fork()) < 0) { + if ((pid = fork()) == -1) { error("ssh_askpass: fork: %s", strerror(errno)); signal(SIGCHLD, osigchld); return NULL; } if (pid == 0) { close(p[0]); - if (dup2(p[1], STDOUT_FILENO) < 0) + if (dup2(p[1], STDOUT_FILENO) == -1) fatal("ssh_askpass: dup2: %s", strerror(errno)); execlp(askpass, askpass, msg, (char *)NULL); fatal("ssh_askpass: exec(%s): %s", askpass, strerror(errno)); @@ -93,7 +93,7 @@ ssh_askpass(char *askpass, const char *msg) buf[len] = '\0'; close(p[0]); - while ((ret = waitpid(pid, &status, 0)) < 0) + while ((ret = waitpid(pid, &status, 0)) == -1) if (errno != EINTR) break; signal(SIGCHLD, osigchld); -- cgit v1.2.3