Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 03 Sep 2019 14:05:54 -0000
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r345647 - head/sbin/fsck_msdosfs
Message-ID:  <201903281820.x2SIKlvQ007683@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Thu Mar 28 18:20:47 2019
New Revision: 345647
URL: https://svnweb.freebsd.org/changeset/base/345647

Log:
  Distinguish between lseek errors and read errores.
  
  MFC after:	2 weeks

Modified:
  head/sbin/fsck_msdosfs/dir.c

Modified: head/sbin/fsck_msdosfs/dir.c
==============================================================================
--- head/sbin/fsck_msdosfs/dir.c	Thu Mar 28 17:30:47 2019	(r345646)
+++ head/sbin/fsck_msdosfs/dir.c	Thu Mar 28 18:20:47 2019	(r345647)
@@ -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;
 		}





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201903281820.x2SIKlvQ007683>