sbin/fsck_msdosfs: Bring in freebsd/freebsd@9503e2d6 (distinguish lseek)
authorTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Sat, 14 Sep 2019 21:22:49 +0000 (06:22 +0900)
committerTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Sat, 14 Sep 2019 22:57:20 +0000 (07:57 +0900)
sbin/fsck_msdosfs/dir.c

index 1564638..a7d908f 100644 (file)
@@ -28,6 +28,7 @@
  */
 
 #include <assert.h>
+#include <inttypes.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -324,8 +325,11 @@ delete(int f, struct bootblock *boot, struct fatEntry *fat, cl_t startcl,
                }
                off = startcl * boot->bpbSecPerClust + boot->ClusterOffset;
                off *= boot->bpbBytesPerSec;
-               if (lseek(f, off, SEEK_SET) != off
-                   || read(f, delbuf, clsz) != clsz) {
+               if (lseek(f, off, SEEK_SET) != off) {
+                       perr("Unable to lseek to %" PRId64, off);
+                       return FSFATAL;
+               }
+               if (read(f, delbuf, clsz) != clsz) {
                        perr("Unable to read directory");
                        return FSFATAL;
                }
@@ -333,8 +337,11 @@ delete(int f, struct bootblock *boot, struct fatEntry *fat, cl_t startcl,
                        *s = SLOT_DELETED;
                        s += 32;
                }
-               if (lseek(f, off, SEEK_SET) != off
-                   || write(f, delbuf, clsz) != clsz) {
+               if (lseek(f, off, SEEK_SET) != off) {
+                       perr("Unable to lseek to %" PRId64, off);
+                       return FSFATAL;
+               }
+               if (write(f, delbuf, clsz) != clsz) {
                        perr("Unable to write directory");
                        return FSFATAL;
                }