(main): Don't assume size_t has the same width
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 30 Sep 2005 05:07:11 +0000 (05:07 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 30 Sep 2005 05:07:11 +0000 (05:07 +0000)
as unsigned long.  Problem reported by Eric Blake.

src/dd.c

index c47249a..0c65149 100644 (file)
--- a/src/dd.c
+++ b/src/dd.c
@@ -1652,13 +1652,14 @@ main (int argc, char **argv)
       if (seek_records != 0 && !(conversions_mask & C_NOTRUNC))
        {
          uintmax_t size = seek_records * output_blocksize;
+         unsigned long int obs = output_blocksize;
 
          if (OFF_T_MAX / output_blocksize < seek_records)
            error (EXIT_FAILURE, 0,
                   _("offset too large: "
                     "cannot truncate to a length of seek=%"PRIuMAX""
                     " (%lu-byte) blocks"),
-                  seek_records, output_blocksize);
+                  seek_records, obs);
 
          if (ftruncate (STDOUT_FILENO, size) != 0)
            {