summaryrefslogtreecommitdiff
path: root/usr.bin/readlink
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2019-06-28 13:35:06 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2019-06-28 13:35:06 +0000
commit61656abc7ff84215165af1bd464bc053b3b66158 (patch)
treec7eabb0c4fa9faa024e724e99c240c40da07ca42 /usr.bin/readlink
parent18603ebf99fbb890ae9666cb0c4aa9f879e7edaa (diff)
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.
Diffstat (limited to 'usr.bin/readlink')
-rw-r--r--usr.bin/readlink/readlink.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/readlink/readlink.c b/usr.bin/readlink/readlink.c
index 6380b3e0e46..0d4e7dfd30f 100644
--- a/usr.bin/readlink/readlink.c
+++ b/usr.bin/readlink/readlink.c
@@ -1,5 +1,5 @@
/*
- * $OpenBSD: readlink.c,v 1.27 2015/10/09 01:37:08 deraadt Exp $
+ * $OpenBSD: readlink.c,v 1.28 2019/06/28 13:35:03 deraadt Exp $
*
* Copyright (c) 1997
* Kenneth Stailey (hereinafter referred to as the author)
@@ -76,7 +76,7 @@ main(int argc, char *argv[])
if (realpath(argv[0], buf) == NULL)
err(1, "%s", argv[0]);
} else {
- if ((n = readlink(argv[0], buf, sizeof buf-1)) < 0)
+ if ((n = readlink(argv[0], buf, sizeof buf-1)) == -1)
exit(1);
buf[n] = '\0';
}