]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
iproute2: remove useless use of buffer
authorAndreas Schwab <schwab@linux-m68k.org>
Fri, 5 Nov 2010 23:26:29 +0000 (23:26 +0000)
committerStephen Hemminger <stephen.hemminger@vyatta.com>
Tue, 30 Nov 2010 17:59:11 +0000 (09:59 -0800)
Print directly to the file instead of going through a buffer.

Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
ip/ipaddress.c

index 19b3d6e4136d902e5f8a737c4e770a9178a0871e..fc306e65df6b8ee15d1fbdbd219b64e4eb528dfe 100644 (file)
@@ -613,23 +613,21 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n,
                fprintf(fp, "%s", (char*)RTA_DATA(rta_tb[IFA_LABEL]));
        if (rta_tb[IFA_CACHEINFO]) {
                struct ifa_cacheinfo *ci = RTA_DATA(rta_tb[IFA_CACHEINFO]);
-               char buf[128];
                fprintf(fp, "%s", _SL_);
+               fprintf(fp, "       valid_lft ");
                if (ci->ifa_valid == INFINITY_LIFE_TIME)
-                       sprintf(buf, "valid_lft forever");
+                       fprintf(fp, "forever");
                else
-                       sprintf(buf, "valid_lft %usec", ci->ifa_valid);
+                       fprintf(fp, "%usec", ci->ifa_valid);
+               fprintf(fp, " preferred_lft ");
                if (ci->ifa_prefered == INFINITY_LIFE_TIME)
-                       sprintf(buf+strlen(buf), " preferred_lft forever");
+                       fprintf(fp, "forever");
                else {
                        if (deprecated)
-                               sprintf(buf+strlen(buf), " preferred_lft %dsec",
-                                       ci->ifa_prefered);
+                               fprintf(fp, "%dsec", ci->ifa_prefered);
                        else
-                               sprintf(buf+strlen(buf), " preferred_lft %usec",
-                                       ci->ifa_prefered);
+                               fprintf(fp, "%usec", ci->ifa_prefered);
                }
-               fprintf(fp, "       %s", buf);
        }
        fprintf(fp, "\n");
        fflush(fp);