gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r2655 - GNUnet/src/util


From: durner
Subject: [GNUnet-SVN] r2655 - GNUnet/src/util
Date: Tue, 25 Apr 2006 10:29:28 -0700 (PDT)

Author: durner
Date: 2006-04-25 10:29:23 -0700 (Tue, 25 Apr 2006)
New Revision: 2655

Modified:
   GNUnet/src/util/statuscalls.c
Log:
Fix integer overflow that caused invalid CPU stats (Mantis #1051)

Modified: GNUnet/src/util/statuscalls.c
===================================================================
--- GNUnet/src/util/statuscalls.c       2006-04-23 23:28:24 UTC (rev 2654)
+++ GNUnet/src/util/statuscalls.c       2006-04-25 17:29:23 UTC (rev 2655)
@@ -295,9 +295,9 @@
   if (proc_stat != NULL) {
     static int last_cpu_results[4] = { 0, 0, 0, 0 };
     char line[128];
-    int user_read, system_read, nice_read, idle_read;
-    int user, system, nice, idle;
-    int usage_time=0, total_time=1;
+    unsigned long long user_read, system_read, nice_read, idle_read;
+    unsigned long long user, system, nice, idle;
+    unsigned long long usage_time=0, total_time=1;
 
     /* Get the first line with the data */
     rewind(proc_stat);
@@ -309,7 +309,7 @@
       fclose(proc_stat);
       proc_stat = NULL; /* don't try again */
     } else {
-      if (sscanf(line, "%*s %i %i %i %i",
+      if (sscanf(line, "%*s %llu %llu %llu %llu",
                 &user_read,
                 &system_read,
                 &nice_read,





reply via email to

[Prev in Thread] Current Thread [Next in Thread]