summaryrefslogtreecommitdiff
path: root/usr.sbin/rpc.lockd
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2019-06-28 13:32:54 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2019-06-28 13:32:54 +0000
commit86ffccf24f66032a89d70a32b3609584c0db7345 (patch)
tree2ae97fac6ea5be57cc953baf8612e8f683da0172 /usr.sbin/rpc.lockd
parentce9fea47562d4f179d45680d6aec00ede2877141 (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.sbin/rpc.lockd')
-rw-r--r--usr.sbin/rpc.lockd/lockd_lock.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.sbin/rpc.lockd/lockd_lock.c b/usr.sbin/rpc.lockd/lockd_lock.c
index bd687a7c803..ad4162b8898 100644
--- a/usr.sbin/rpc.lockd/lockd_lock.c
+++ b/usr.sbin/rpc.lockd/lockd_lock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lockd_lock.c,v 1.9 2015/01/16 06:40:20 deraadt Exp $ */
+/* $OpenBSD: lockd_lock.c,v 1.10 2019/06/28 13:32:50 deraadt Exp $ */
/*
* Copyright (c) 2000 Manuel Bouyer.
@@ -508,7 +508,7 @@ do_lock(struct file_lock *fl, int block)
struct stat st;
fl->fd = fhopen((fhandle_t *)fl->filehandle.fhdata, O_RDWR);
- if (fl->fd < 0) {
+ if (fl->fd == -1) {
switch (errno) {
case ESTALE:
error = nlm4_stale_fh;
@@ -526,7 +526,7 @@ do_lock(struct file_lock *fl, int block)
LIST_REMOVE(fl, lcklst);
return error;
}
- if (fstat(fl->fd, &st) < 0) {
+ if (fstat(fl->fd, &st) == -1) {
syslog(LOG_NOTICE, "fstat failed (from %s) (%m)",
fl->client_name);
}
@@ -738,7 +738,7 @@ siglock(void)
sigemptyset(&block);
sigaddset(&block, SIGCHLD);
- if (sigprocmask(SIG_BLOCK, &block, NULL) < 0) {
+ if (sigprocmask(SIG_BLOCK, &block, NULL) == -1) {
syslog(LOG_WARNING, "siglock failed (%m)");
}
}
@@ -751,7 +751,7 @@ sigunlock(void)
sigemptyset(&block);
sigaddset(&block, SIGCHLD);
- if (sigprocmask(SIG_UNBLOCK, &block, NULL) < 0) {
+ if (sigprocmask(SIG_UNBLOCK, &block, NULL) == -1) {
syslog(LOG_WARNING, "sigunlock failed (%m)");
}
}