Date: Thu, 1 May 2014 09:30:02 GMT From: Thomas Quinot <thomas@quinot.org> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/189174: dd conv=sparse bs=64k EINVAL on sparse last block Message-ID: <201405010930.s419U22n057105@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
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é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; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201405010930.s419U22n057105>