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/cp/utils.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/cp/utils.c')
-rw-r--r-- | bin/cp/utils.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/bin/cp/utils.c b/bin/cp/utils.c index 2275c127b76..a2f480c3393 100644 --- a/bin/cp/utils.c +++ b/bin/cp/utils.c @@ -1,4 +1,4 @@ -/* $OpenBSD: utils.c,v 1.47 2019/01/28 18:58:42 jca Exp $ */ +/* $OpenBSD: utils.c,v 1.48 2019/06/28 13:34:58 deraadt Exp $ */ /* $NetBSD: utils.c,v 1.6 1997/02/26 14:40:51 cgd Exp $ */ /*- @@ -129,7 +129,7 @@ copy_file(FTSENT *entp, int exists) rval = 1; } /* Some systems don't unmap on close(2). */ - if (munmap(p, fs->st_size) < 0) { + if (munmap(p, fs->st_size) == -1) { warn("%s", entp->fts_path); rval = 1; } @@ -152,9 +152,9 @@ copy_file(FTSENT *entp, int exists) break; } } - if (skipholes && rcount >= 0) + if (skipholes && rcount != -1) rcount = ftruncate(to_fd, lseek(to_fd, 0, SEEK_CUR)); - if (rcount < 0) { + if (rcount == -1) { warn("%s", entp->fts_path); rval = 1; } |