Re: bin/189174: dd conv=sparse bs=64k EINVAL on sparse last bloc
--===============2702114971841050599==
Content-Type: text/plain
The following reply was made to PR bin/189174; it has been noted by GNATS.
From: Thomas Quinot <thomas@quinot.org>
To: bug-followup@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@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憝ision 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;
}
--===============2702114971841050599==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
freebsd-bugs@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscribe@freebsd.org"
--===============2702114971841050599==--