Hi,

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.
-- 
Amit Kale
Veritas Software ( http://www.veritas.com )

--- 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
@@ -979,7 +979,15 @@
              quit (1);
            }
          else if (n_bytes_read == input_blocksize)
-           w_full++;
+           {
+             if (nwritten == n_bytes_read)
+                   w_full++;
+             else
+               {
+                 w_partial++;
+                 break;
+               }
+           }
          else
            w_partial++;
          continue; 

Reply via email to