]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
Avoid overflow in nfsstats printing nfs-utils-1-1-0-pre5
authorneilbrown <neilbrown>
Fri, 30 May 2003 05:41:10 +0000 (05:41 +0000)
committerneilbrown <neilbrown>
Fri, 30 May 2003 05:41:10 +0000 (05:41 +0000)
ChangeLog
utils/nfsstat/nfsstat.c

index 414a52681fb3403d19c3e064cac673c3fe665b11..5a53aa6ba62a588210a47188e65dcb1d34a5c362 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2003-05-30 Michael Griffith <grif@michaelgriffith.com>
+       NeilBrown <neilb@cse.unsw.edu.au>
+
+       utils/nfsstat/nfsstat.c(print_callstats): use unsigned
+       long long to avoid overflow when printing stats.
+       
 2003-05-30  NeilBrown <neilb@cse.unsw.edu.au>
 
        * support/export/export.c, support/include/nfslib.h,
index 739dabac1683880df1df2d9eb379bedec6a0e73a..b26b3b8a04acacad40a1a6d89311e895d615abc1 100644 (file)
@@ -307,7 +307,8 @@ static void
 print_callstats(const char *hdr, const char **names,
                                 unsigned int *info, unsigned int nr)
 {
-       unsigned int    total;
+       unsigned long long      total;
+       unsigned long long      pct;
        int             i, j;
 
        fputs(hdr, stdout);
@@ -319,9 +320,10 @@ print_callstats(const char *hdr, const char **names,
                for (j = 0; j < 6 && i + j < nr; j++)
                        printf("%-11s", names[i+j]);
                printf("\n");
-               for (j = 0; j < 6 && i + j < nr; j++)
-                       printf("%-6d %2d%% ",
-                               info[i+j], 100 * info[i+j] / total);
+               for (j = 0; j < 6 && i + j < nr; j++) {
+                       pct = ((unsigned long long) info[i+j]*100)/total;
+                       printf("%-6d %2llu%% ", info[i+j], pct);
+               }
                printf("\n");
        }
        printf("\n");