summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6e3c5c4)
raw | patch | inline | side by side (parent: 6e3c5c4)
author | Florian Forster <octo@huhu.verplant.org> | |
Tue, 26 Jan 2010 23:07:50 +0000 (00:07 +0100) | ||
committer | Florian Forster <octo@huhu.verplant.org> | |
Tue, 26 Jan 2010 23:07:50 +0000 (00:07 +0100) |
Using "strtoul" for derive_t values fails for large counter values.
Thanks to Martin Merkel for reporting this :)
Thanks to Martin Merkel for reporting this :)
src/contextswitch.c | patch | blob | history |
diff --git a/src/contextswitch.c b/src/contextswitch.c
index 7787203dde178ad2b5859fd603bf7085b90ba663..06055ca59372299616a6f8b1bf105d30e34760f4 100644 (file)
--- a/src/contextswitch.c
+++ b/src/contextswitch.c
# error "No applicable input method."
#endif
-static void cs_submit (unsigned long context_switches)
+static void cs_submit (derive_t context_switches)
{
value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
char buffer[64];
int numfields;
char *fields[3];
- unsigned long result = 0;
+ derive_t result = 0;
int status = -2;
fh = fopen ("/proc/stat", "r");
errno = 0;
endptr = NULL;
- result = strtoul(fields[1], &endptr, 10);
+ result = (derive_t) strtoll (fields[1], &endptr, /* base = */ 10);
if ((endptr == fields[1]) || (errno != 0)) {
ERROR ("contextswitch plugin: Cannot parse ctxt value: %s",
fields[1]);