summaryrefslogtreecommitdiff
path: root/usr.bin/rsync/io.c
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/rsync/io.c
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/rsync/io.c')
-rw-r--r--usr.bin/rsync/io.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/rsync/io.c b/usr.bin/rsync/io.c
index 18e483af259..8d113d6d013 100644
--- a/usr.bin/rsync/io.c
+++ b/usr.bin/rsync/io.c
@@ -1,4 +1,4 @@
-/* $Id: io.c,v 1.17 2019/05/08 21:30:11 benno Exp $ */
+/* $Id: io.c,v 1.18 2019/06/28 13:35:03 deraadt Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -40,7 +40,7 @@ io_read_check(int fd)
pfd.fd = fd;
pfd.events = POLLIN;
- if (poll(&pfd, 1, 0) < 0) {
+ if (poll(&pfd, 1, 0) == -1) {
ERR("poll");
return -1;
}
@@ -89,7 +89,7 @@ io_write_nonblocking(int fd, const void *buf, size_t bsz,
/* Now the non-blocking write. */
- if ((wsz = write(fd, buf, bsz)) < 0) {
+ if ((wsz = write(fd, buf, bsz)) == -1) {
ERR("write");
return 0;
}
@@ -217,7 +217,7 @@ io_read_nonblocking(int fd, void *buf, size_t bsz, size_t *sz)
/* Now the non-blocking read, checking for EOF. */
- if ((rsz = read(fd, buf, bsz)) < 0) {
+ if ((rsz = read(fd, buf, bsz)) == -1) {
ERR("read");
return 0;
} else if (rsz == 0) {