diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2019-06-28 13:35:06 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2019-06-28 13:35:06 +0000 |
commit | 61656abc7ff84215165af1bd464bc053b3b66158 (patch) | |
tree | c7eabb0c4fa9faa024e724e99c240c40da07ca42 /bin/ln/ln.c | |
parent | 18603ebf99fbb890ae9666cb0c4aa9f879e7edaa (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 'bin/ln/ln.c')
-rw-r--r-- | bin/ln/ln.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/bin/ln/ln.c b/bin/ln/ln.c index ae0d34ed383..ec191ef6aac 100644 --- a/bin/ln/ln.c +++ b/bin/ln/ln.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ln.c,v 1.24 2016/05/10 20:20:43 tim Exp $ */ +/* $OpenBSD: ln.c,v 1.25 2019/06/28 13:34:59 deraadt Exp $ */ /* $NetBSD: ln.c,v 1.10 1995/03/21 09:06:10 cgd Exp $ */ /* @@ -178,7 +178,7 @@ linkit(char *target, char *source, int isdir) * If the file exists, and -f was specified, unlink it. * Attempt the link. */ - if ((fflag && unlink(source) < 0 && errno != ENOENT) || + if ((fflag && unlink(source) == -1 && errno != ENOENT) || (sflag ? symlink(target, source) : linkat(AT_FDCWD, target, AT_FDCWD, source, Pflag ? 0 : AT_SYMLINK_FOLLOW))) { |