summaryrefslogtreecommitdiff
path: root/ssh-add.c
diff options
context:
space:
mode:
authorderaadt@openbsd.org <deraadt@openbsd.org>2019-06-28 13:35:04 +0000
committerDamien Miller <djm@mindrot.org>2019-07-05 11:10:39 +1000
commit4d28fa78abce2890e136281950633fae2066cc29 (patch)
tree33226ec64ced661bb7e40005e30744b68fa59a80 /ssh-add.c
parente8c974043c1648eab0ad67a7ba6a3e444fe79d2d (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 'ssh-add.c')
-rw-r--r--ssh-add.c6
1 files changed, 3 insertions, 3 deletions
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 @@
1/* $OpenBSD: ssh-add.c,v 1.139 2019/06/06 05:13:13 otto Exp $ */ 1/* $OpenBSD: ssh-add.c,v 1.140 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
@@ -203,7 +203,7 @@ add_file(int agent_fd, const char *filename, int key_only, int qflag)
203 if (strcmp(filename, "-") == 0) { 203 if (strcmp(filename, "-") == 0) {
204 fd = STDIN_FILENO; 204 fd = STDIN_FILENO;
205 filename = "(stdin)"; 205 filename = "(stdin)";
206 } else if ((fd = open(filename, O_RDONLY)) < 0) { 206 } else if ((fd = open(filename, O_RDONLY)) == -1) {
207 perror(filename); 207 perror(filename);
208 return -1; 208 return -1;
209 } 209 }
@@ -727,7 +727,7 @@ main(int argc, char **argv)
727 for (i = 0; default_files[i]; i++) { 727 for (i = 0; default_files[i]; i++) {
728 snprintf(buf, sizeof(buf), "%s/%s", pw->pw_dir, 728 snprintf(buf, sizeof(buf), "%s/%s", pw->pw_dir,
729 default_files[i]); 729 default_files[i]);
730 if (stat(buf, &st) < 0) 730 if (stat(buf, &st) == -1)
731 continue; 731 continue;
732 if (do_file(agent_fd, deleting, key_only, buf, 732 if (do_file(agent_fd, deleting, key_only, buf,
733 qflag) == -1) 733 qflag) == -1)