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 --- ssh-add.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ssh-add.c') diff --git a/ssh-add.c b/ssh-add.c index 9cf298918..bc2360e1e 100644 --- a/ssh-add.c +++ b/ssh-add.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh-add.c,v 1.139 2019/06/06 05:13:13 otto Exp $ */ +/* $OpenBSD: ssh-add.c,v 1.140 2019/06/28 13:35:04 deraadt Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -203,7 +203,7 @@ add_file(int agent_fd, const char *filename, int key_only, int qflag) if (strcmp(filename, "-") == 0) { fd = STDIN_FILENO; filename = "(stdin)"; - } else if ((fd = open(filename, O_RDONLY)) < 0) { + } else if ((fd = open(filename, O_RDONLY)) == -1) { perror(filename); return -1; } @@ -727,7 +727,7 @@ main(int argc, char **argv) for (i = 0; default_files[i]; i++) { snprintf(buf, sizeof(buf), "%s/%s", pw->pw_dir, default_files[i]); - if (stat(buf, &st) < 0) + if (stat(buf, &st) == -1) continue; if (do_file(agent_fd, deleting, key_only, buf, qflag) == -1) -- cgit v1.2.3