enforce singular of packets
authorAndreas Steffen <andreas.steffen@strongswan.org>
Fri, 22 Mar 2013 20:13:59 +0000 (21:13 +0100)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Fri, 22 Mar 2013 20:14:04 +0000 (21:14 +0100)
src/libcharon/plugins/stroke/stroke_list.c

index 7f36814..a2e1c80 100644 (file)
@@ -278,8 +278,9 @@ static void log_child_sa(FILE *out, child_sa_t *child_sa, bool all)
                        fprintf(out, ", %" PRIu64 " bytes_i", bytes_in);
                        if (use_in)
                        {
-                               fprintf(out, " (%" PRIu64 " pkts, %" PRIu64 "s ago)",
-                                               packets_in, (u_int64_t)(now - use_in));
+                               fprintf(out, " (%" PRIu64 " pkt%s, %" PRIu64 "s ago)",
+                                               packets_in, (packets_in == 1) ? "": "s",
+                                               (u_int64_t)(now - use_in));
                        }
 
                        child_sa->get_usestats(child_sa, FALSE,
@@ -287,8 +288,9 @@ static void log_child_sa(FILE *out, child_sa_t *child_sa, bool all)
                        fprintf(out, ", %" PRIu64 " bytes_o", bytes_out);
                        if (use_out)
                        {
-                               fprintf(out, " (%" PRIu64 " pkts, %" PRIu64 "s ago)",
-                                               packets_out, (u_int64_t)(now - use_out));
+                               fprintf(out, " (%" PRIu64 " pkt%s, %" PRIu64 "s ago)",
+                                               packets_out, (packets_out == 1) ? "": "s",
+                                               (u_int64_t)(now - use_out));
                        }
                        fprintf(out, ", rekeying ");