bin/189174: dd conv=sparse bs=64k EINVAL on sparse last block

Thomas Quinot thomas at quinot.org
Thu May 1 09:30:03 UTC 2014


The following reply was made to PR bin/189174; it has been noted by GNATS.

From: Thomas Quinot <thomas at quinot.org>
To: bug-followup at freebsd.org
Cc:  
Subject: Re: bin/189174: dd conv=sparse bs=64k EINVAL on sparse last block
Date: Thu, 1 May 2014 11:28:25 +0200

 * FreeBSD-gnats-submit at FreeBSD.org, 2014-05-01 :
 
 > >Category:       bin
 > >Responsible:    freebsd-bugs
 > >Synopsis:       dd conv=sparse bs=64k EINVAL on sparse last block
 > >Arrival-Date:   Thu May 01 09:20:00 UTC 2014
 
 The following fix appears to fix the problem here:
 
 Index: dd.c
 ===================================================================
 --- dd.c	(révision 265172)
 +++ dd.c	(copie de travail)
 @@ -450,13 +450,16 @@
  				nw = cnt;
  			} else {
  				if (pending != 0) {
 -					if (force)
 +					/* If forced to write, and we have no data left, we need
 +                                         * to write an explicit 0.
 +                                         */
 +					if (force && cnt == 0)
  						pending--;
  					if (lseek(out.fd, pending, SEEK_CUR) ==
  					    -1)
  						err(2, "%s: seek error creating sparse file",
  						    out.name);
 -					if (force)
 +					if (force && cnt == 0)
  						write(out.fd, outp, 1);
  					pending = 0;
  				}


More information about the freebsd-bugs mailing list