"Amit S. Kale" <[EMAIL PROTECTED]> writes:
| full-write beyond end of a raw device on linux puts dd in an infinite loop.
| This is because a raw device return 0 on write beyond end of the device.
|
| I think the problem could be solved by following patches. I have tried these
| patches. dd with these patches gives correct values.
|
| Can you please include these patches in file-utils?

Thanks for the patches, however I think the proper fix is not here,
but in the kernel.  What version of Linux are you using?

I just confirmed that with 2.2.9 and 2.2.14 kernels,
that dd command fails as one would expect:

  $ dd if=/dev/zero of=/dev/fd0
  dd: /dev/fd0: No space left on device
  2881+0 records in
  2880+0 records out
  [Exit 1]
  $

I've removed the misleading `FIXME' from the comment below.

| --- full-write.c.orig   Wed Feb 25 04:47:38 1998
| +++ full-write.c        Mon Apr 24 18:28:37 2000
| @@ -45,10 +45,9 @@
|    while (len > 0)
|      {
|        int written = write (desc, ptr, len);
| -      /* FIXME: write on my slackware Linux 1.2.13 returns zero when
| -        I try to write more data than there is room on a floppy disk.
| -        This puts dd into an infinite loop.  Reproduce with
| -        dd if=/dev/zero of=/dev/fd0.  */
| +      if (written == 0) {
| +             return total_written;
| +      }
|        if (written < 0)
|         {
|  #ifdef EINTR
|
| --- dd.c.orig   Wed Jan 26 16:39:01 2000
| +++ dd.c        Mon Apr 24 18:41:03 2000
...

Reply via email to