Author: delphij
Date: Fri Apr 12 02:24:06 2019
New Revision: 346146
URL: https://svnweb.freebsd.org/changeset/base/346146

Log:
  MFC r345647:
  
  Distinguish between lseek errors and read errores.

Modified:
  stable/12/sbin/fsck_msdosfs/dir.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/fsck_msdosfs/dir.c
==============================================================================
--- stable/12/sbin/fsck_msdosfs/dir.c   Fri Apr 12 01:03:00 2019        
(r346145)
+++ stable/12/sbin/fsck_msdosfs/dir.c   Fri Apr 12 02:24:06 2019        
(r346146)
@@ -35,6 +35,7 @@ static const char rcsid[] =
   "$FreeBSD$";
 #endif /* not lint */
 
+#include <inttypes.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -329,8 +330,11 @@ delete(int f, struct bootblock *boot, struct fatEntry 
                }
                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;
                }
@@ -338,8 +342,11 @@ delete(int f, struct bootblock *boot, struct fatEntry 
                        *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;
                }


_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to