[PATCH] ping: change dupmsg display

Denys Vlasenko vda.linux at googlemail.com
Fri Oct 7 16:09:19 UTC 2016


Why?

On Wed, Oct 5, 2016 at 5:37 PM, Attila Szasz <smortep at gmail.com> wrote:
> --- ./busybox/networking/ping.c 2016-10-05 15:11:57.896058866 +0200
> +++ ./busybox-ping/networking/ping.c 2016-10-05 15:10:20.884057771 +0200
> @@ -589,7 +589,7 @@
>   uint16_t recv_seq, int ttl)
>  {
>   unsigned char *b, m;
> - const char *dupmsg = " (DUP!)";
> + int dupflag = 0;
>   unsigned triptime = triptime; /* for gcc */
>
>   if (tp) {
> @@ -608,11 +608,11 @@
>   /*if TST(recv_seq % MAX_DUP_CHK):*/
>   if (*b & m) {
>   ++G.nrepeats;
> +                dupflag = 1;
>   } else {
>   /*SET(recv_seq % MAX_DUP_CHK):*/
>   *b |= m;
>   ++G.nreceived;
> - dupmsg += 7;
>   }
>
>   if (option_mask32 & OPT_QUIET)
> @@ -622,7 +622,8 @@
>   from_str, recv_seq, ttl);
>   if (tp)
>   printf(" time=%u.%03u ms", triptime / 1000, triptime % 1000);
> - puts(dupmsg);
> +        if (dupflag)
> + puts(" (DUP!)");
>   fflush_all();
>  }
>  static void unpack4(char *buf, int sz, struct sockaddr_in *from)
>
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox


More information about the busybox mailing list