inetd: comment tweak. no code changes
[oweals/busybox.git] / coreutils / dd.c
index e172b0c292182880b8935531eba9a15cec737df2..5281d811829077cf7848d9505ceb89fb3067e2ea 100644 (file)
@@ -8,7 +8,6 @@
  * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
  */
 
-#include <signal.h>  /* For FEATURE_DD_SIGNAL_HANDLING */
 #include "libbb.h"
 
 /* This is a NOEXEC applet. Be very careful! */
@@ -41,7 +40,7 @@ struct globals {
 #define INIT_G() memset(&G, 0, sizeof(G))
 
 
-static void dd_output_status(int ATTRIBUTE_UNUSED cur_signal)
+static void dd_output_status(int UNUSED_PARAM cur_signal)
 {
        /* Deliberately using %u, not %d */
        fprintf(stderr, "%"OFF_FMT"u+%"OFF_FMT"u records in\n"
@@ -65,7 +64,7 @@ static bool write_and_stats(const void *buf, size_t len, size_t obs,
        ssize_t n = full_write_or_warn(buf, len, filename);
        if (n < 0)
                return 1;
-       if (n == obs)
+       if ((size_t)n == obs)
                G.out_full++;
        else if (n) /* > 0 */
                G.out_part++;
@@ -79,7 +78,7 @@ static bool write_and_stats(const void *buf, size_t len, size_t obs,
 #endif
 
 int dd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
-int dd_main(int argc ATTRIBUTE_UNUSED, char **argv)
+int dd_main(int argc UNUSED_PARAM, char **argv)
 {
        enum {
                /* Must be in the same order as OP_conv_XXX! */
@@ -93,9 +92,9 @@ int dd_main(int argc ATTRIBUTE_UNUSED, char **argv)
                FLAG_COUNT   = 1 << 5,
        };
        static const char keywords[] ALIGN1 =
-               "bs=\0""count=\0""seek=\0""skip=\0""if=\0""of=\0"
+               "bs\0""count\0""seek\0""skip\0""if\0""of\0"
 #if ENABLE_FEATURE_DD_IBS_OBS
-               "ibs=\0""obs=\0""conv=\0"
+               "ibs\0""obs\0""conv\0"
 #endif
                ;
 #if ENABLE_FEATURE_DD_IBS_OBS
@@ -297,6 +296,8 @@ int dd_main(int argc ATTRIBUTE_UNUSED, char **argv)
                                goto die_infile;
                        n = ibs;
                        bb_simple_perror_msg(infile);
+                       /* GNU dd with conv=noerror skips over "bad blocks" */
+                       xlseek(ifd, ibs, SEEK_CUR);
                }
                if ((size_t)n == ibs)
                        G.in_full++;
@@ -312,7 +313,7 @@ int dd_main(int argc ATTRIBUTE_UNUSED, char **argv)
                        while (n) {
                                size_t d = obs - oc;
 
-                               if (d > n)
+                               if (d > (size_t)n)
                                        d = n;
                                memcpy(obuf + oc, tmp, d);
                                n -= d;