diff options
author | Mike Frysinger <vapier@gentoo.org> | 2005-05-23 00:46:30 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2005-05-23 00:46:30 +0000 |
commit | b31abca4aebbc358bab42634aaead8cd5fd9b7e3 (patch) | |
tree | cc9a0fe4e9743cc2a5e231560c2f4a90a1f21af9 /net-analyzer/vnstat/files | |
parent | Stable on SPARC. (diff) | |
download | gentoo-2-b31abca4aebbc358bab42634aaead8cd5fd9b7e3.tar.gz gentoo-2-b31abca4aebbc358bab42634aaead8cd5fd9b7e3.tar.bz2 gentoo-2-b31abca4aebbc358bab42634aaead8cd5fd9b7e3.zip |
Add patch by Aleksey Fedoseev to support ifaces with long names.
(Portage version: 2.0.51.22-r1)
Diffstat (limited to 'net-analyzer/vnstat/files')
-rw-r--r-- | net-analyzer/vnstat/files/digest-vnstat-1.4-r1 | 1 | ||||
-rw-r--r-- | net-analyzer/vnstat/files/vnstat-1.4-long_iface_name.patch | 49 |
2 files changed, 50 insertions, 0 deletions
diff --git a/net-analyzer/vnstat/files/digest-vnstat-1.4-r1 b/net-analyzer/vnstat/files/digest-vnstat-1.4-r1 new file mode 100644 index 000000000000..c2424fe6d2b1 --- /dev/null +++ b/net-analyzer/vnstat/files/digest-vnstat-1.4-r1 @@ -0,0 +1 @@ +MD5 9184f79b5e60499bc059f670032291e5 vnstat-1.4.tar.gz 26237 diff --git a/net-analyzer/vnstat/files/vnstat-1.4-long_iface_name.patch b/net-analyzer/vnstat/files/vnstat-1.4-long_iface_name.patch new file mode 100644 index 000000000000..ba869b6fb7dd --- /dev/null +++ b/net-analyzer/vnstat/files/vnstat-1.4-long_iface_name.patch @@ -0,0 +1,49 @@ +Interface names can be more than 7 chars long. + +Patch by Aleksey Fedoseev. + +--- vnstat-1.4/src/proc.c ++++ vnstat-1.4/src/proc.c +@@ -64,6 +64,7 @@ + void parseproc(int newdb) + { + char temp[64]; ++ char* colon_pos; + uint64_t rx, tx, rxchange=0, txchange=0, btime; /* rxchange = rx change in MB */ + uint64_t krxchange=0, ktxchange=0; /* krxchange = rx change in kB */ + time_t current; +@@ -86,12 +87,22 @@ + + current=time(NULL); + +- /* get rx from procline, easy since it's always procline+7 */ ++ /* get rx position, then get it from procline */ ++ ++ colon_pos = strchr(procline, ':'); ++ if (colon_pos == NULL) { ++ if (debug) { ++ printf("Bad /proc/net/dev string"); ++ } ++ return; ++ } ++ ++ colon_pos++; + + #ifdef BLIMIT +- rx=strtoull(procline+7, (char **)NULL, 0); ++ rx=strtoull(colon_pos, (char **)NULL, 0); + #else +- rx=strtoul(procline+7, (char **)NULL, 0); ++ rx=strtoul(colon_pos, (char **)NULL, 0); + #endif + + if (newdb!=1) { +@@ -116,7 +127,7 @@ + + + /* get tx from procline, ugly hack */ +- sscanf(procline+7,"%s %s %s %s %s %s %s %s %s",temp,temp,temp,temp,temp,temp,temp,temp,temp); ++ sscanf(colon_pos, "%s %s %s %s %s %s %s %s %s",temp,temp,temp,temp,temp,temp,temp,temp,temp); + + #ifdef BLIMIT + tx=strtoull(temp, (char **)NULL, 0); |