summaryrefslogtreecommitdiffstats
path: root/usr.sbin/edquota
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2019-06-28 13:32:41 +0000
committerderaadt <deraadt@openbsd.org>2019-06-28 13:32:41 +0000
commitdf69c215c7c66baf660f3f65414fd34796c96152 (patch)
tree0255639162b24c4a2f761a274e32b69c2256fd45 /usr.sbin/edquota
parentminiroot prototype disklabels should attempt to contain accurate (diff)
downloadwireguard-openbsd-df69c215c7c66baf660f3f65414fd34796c96152.tar.xz
wireguard-openbsd-df69c215c7c66baf660f3f65414fd34796c96152.zip
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/edquota')
-rw-r--r--usr.sbin/edquota/edquota.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.sbin/edquota/edquota.c b/usr.sbin/edquota/edquota.c
index 402c5511424..69ab46ecfae 100644
--- a/usr.sbin/edquota/edquota.c
+++ b/usr.sbin/edquota/edquota.c
@@ -266,9 +266,9 @@ getprivs(u_int id, int quotatype)
"group %s not known, skipping %s\n",
quotagroup, fs->fs_file);
}
- if ((fd = open(qfpathname, O_RDONLY)) < 0) {
+ if ((fd = open(qfpathname, O_RDONLY)) == -1) {
fd = open(qfpathname, O_RDWR|O_CREAT, 0640);
- if (fd < 0 && errno != ENOENT) {
+ if (fd == -1 && errno != ENOENT) {
perror(qfpathname);
free(qup);
continue;
@@ -327,7 +327,7 @@ putprivs(long id, int quotatype, struct quotause *quplist)
for (qup = quplist; qup; qup = qup->next) {
if (quotactl(qup->fsname, qcmd, id, (char *)&qup->dqblk) == 0)
continue;
- if ((fd = open(qup->qfname, O_WRONLY)) < 0) {
+ if ((fd = open(qup->qfname, O_WRONLY)) == -1) {
perror(qup->qfname);
} else {
lseek(fd, (off_t)(id * sizeof (struct dqblk)), SEEK_SET);