commit c64b5b04c7993765ab67207e86db92a48d7087f4
Author:     Eivind Uggedal <[email protected]>
AuthorDate: Tue Mar 15 20:16:05 2016 +0000
Commit:     sin <[email protected]>
CommitDate: Wed Mar 16 10:17:51 2016 +0000

    dd: allow count=0

diff --git a/dd.c b/dd.c
index 07fdbc9..1e1fda1 100644
--- a/dd.c
+++ b/dd.c
@@ -126,7 +126,7 @@ prepare_copy(struct dd_config *ddc, int *ifd, int *ofd)
        ddc->count *= ddc->bs;
 
        /* If no count is given, its the filesize minus skip offset */
-       if (ddc->count == 0)
+       if (ddc->count == (uint64_t) -1)
                ddc->count = ddc->fsize - ddc->skip;
 
        return 0;
@@ -243,6 +243,7 @@ main(int argc, char *argv[])
        config.bs = 1<<16;
        config.in = NULL;
        config.out = NULL;
+       config.count = (uint64_t) -1;
 
        /* emulate 'dd' argument parsing */
        for (i = 1; i < argc; ++i) {

Reply via email to