summaryrefslogtreecommitdiff
path: root/sbin/fsck_msdos
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/fsck_msdos
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/fsck_msdos')
-rw-r--r--sbin/fsck_msdos/check.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sbin/fsck_msdos/check.c b/sbin/fsck_msdos/check.c
index a5d972d49f0..4a2f07f1131 100644
--- a/sbin/fsck_msdos/check.c
+++ b/sbin/fsck_msdos/check.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: check.c,v 1.19 2018/09/24 21:26:02 deraadt Exp $ */
+/* $OpenBSD: check.c,v 1.20 2019/06/28 13:32:43 deraadt Exp $ */
/* $NetBSD: check.c,v 1.8 1997/10/17 11:19:29 ws Exp $ */
/*
@@ -60,11 +60,11 @@ checkfilesys(const char *fname)
rdonly = alwaysno;
dosfs = opendev(fname, rdonly ? O_RDONLY : O_RDWR, 0, &realdev);
- if (dosfs < 0 && !rdonly) {
+ if (dosfs == -1 && !rdonly) {
dosfs = opendev(fname, O_RDONLY, 0, &realdev);
rdonly = 1;
}
- if (dosfs < 0) {
+ if (dosfs == -1) {
xperror("Can't open");
return (8);
}
@@ -78,7 +78,7 @@ checkfilesys(const char *fname)
printf("\n");
}
- if (ioctl(dosfs, DIOCGDINFO, (char *)&lab) < 0)
+ if (ioctl(dosfs, DIOCGDINFO, (char *)&lab) == -1)
pfatal("can't read disk label for %s\n", fname);
if (pledge("stdio", NULL) == -1)