diff options
author | deraadt@openbsd.org <deraadt@openbsd.org> | 2019-06-28 15:35:04 +0200 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2019-07-05 03:10:39 +0200 |
commit | 4d28fa78abce2890e136281950633fae2066cc29 (patch) | |
tree | 33226ec64ced661bb7e40005e30744b68fa59a80 /ssh-add.c | |
parent | upstream: asprintf returns -1, not an arbitrary value < 0. Also (diff) | |
download | openssh-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-add.c')
-rw-r--r-- | ssh-add.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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 <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, 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) |