From df69c215c7c66baf660f3f65414fd34796c96152 Mon Sep 17 00:00:00 2001 From: deraadt Date: Fri, 28 Jun 2019 13:32:41 +0000 Subject: 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. --- usr.sbin/edquota/edquota.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'usr.sbin/edquota') 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); -- cgit v1.2.3-59-g8ed1b