summaryrefslogtreecommitdiff
path: root/sbin/mountd
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 /sbin/mountd
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 'sbin/mountd')
-rw-r--r--sbin/mountd/mountd.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sbin/mountd/mountd.c b/sbin/mountd/mountd.c
index 0e09071a5df..40b09fc2cb7 100644
--- a/sbin/mountd/mountd.c
+++ b/sbin/mountd/mountd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mountd.c,v 1.86 2018/04/28 09:56:21 guenther Exp $ */
+/* $OpenBSD: mountd.c,v 1.87 2019/06/28 13:32:45 deraadt Exp $ */
/* $NetBSD: mountd.c,v 1.31 1996/02/18 11:57:53 fvdl Exp $ */
/*
@@ -780,9 +780,9 @@ mntsrv(struct svc_req *rqstp, SVCXPRT *transp)
fprintf(stderr, "realpath failed on %s\n",
rpcpath);
strlcpy(dirpath, rpcpath, sizeof(dirpath));
- } else if (stat(dirpath, &stb) < 0 ||
+ } else if (stat(dirpath, &stb) == -1 ||
(!S_ISDIR(stb.st_mode) && !S_ISREG(stb.st_mode)) ||
- statfs(dirpath, &fsb) < 0) {
+ statfs(dirpath, &fsb) == -1) {
if (debug)
fprintf(stderr, "stat failed on %s\n", dirpath);
bad = ENOENT; /* We will send error reply later */
@@ -2408,13 +2408,13 @@ check_dirpath(char *dirp)
while (*cp && ret) {
if (*cp == '/') {
*cp = '\0';
- if (lstat(dirp, &sb) < 0 || !S_ISDIR(sb.st_mode))
+ if (lstat(dirp, &sb) == -1 || !S_ISDIR(sb.st_mode))
ret = 0;
*cp = '/';
}
cp++;
}
- if (lstat(dirp, &sb) < 0 ||
+ if (lstat(dirp, &sb) == -1 ||
(!S_ISDIR(sb.st_mode) && !S_ISREG(sb.st_mode)))
ret = 0;
return (ret);