summaryrefslogtreecommitdiff
path: root/openwrt/package/rrdcollect/patches
diff options
context:
space:
mode:
authorolli <olli@3c298f89-4303-0410-b956-a3cf2f4a3e73>2006-01-22 11:44:35 +0000
committerolli <olli@3c298f89-4303-0410-b956-a3cf2f4a3e73>2006-01-22 11:44:35 +0000
commit08f894518fddd748993ec8fba56527bd0f7e281c (patch)
treed8feb8a388b78a1876e9e7f12d40c7b52b93b221 /openwrt/package/rrdcollect/patches
parentcd503eb481d67b937cf4f5301f5e925991d93a62 (diff)
fix rrdcollect bug (closes #220)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@3033 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'openwrt/package/rrdcollect/patches')
-rw-r--r--openwrt/package/rrdcollect/patches/rrdcollect-scan.patch66
1 files changed, 66 insertions, 0 deletions
diff --git a/openwrt/package/rrdcollect/patches/rrdcollect-scan.patch b/openwrt/package/rrdcollect/patches/rrdcollect-scan.patch
new file mode 100644
index 0000000000..f47301ed13
--- /dev/null
+++ b/openwrt/package/rrdcollect/patches/rrdcollect-scan.patch
@@ -0,0 +1,66 @@
+diff -ruN rrdcollect-0.2.3.orig/src/scan.c rrdcollect-0.2.3/src/scan.c
+--- rrdcollect-0.2.3.orig/src/scan.c 2005-01-20 18:42:17.000000000 +0100
++++ rrdcollect-0.2.3/src/scan.c 2006-01-22 00:51:52.000000000 +0100
+@@ -74,6 +74,11 @@
+ } while (isdigit(*fmt));
+ }
+
++ /* skip white spaces like scanf does */
++ if (strchr("difuoxX", *fmt))
++ while (isspace(*buf))
++ buf++;
++
+ /* FIXME: we should check afterward:
+ * if (start == buf || start == '-' && buf-start == 1)
+ * die("WTF??? zero-length number???");
+@@ -150,27 +155,22 @@
+ buf++, length--;
+ }
+
+- /* ignore if value not found */
+- if(value == 0)
+- return 0;
+-
+ if (!ignore)
+- counter[i++]->value = valuedup(value);
++ counter[i++]->value = strndup(start, buf - start);
+ break;
+
+ case 'c':
++ if (length < 0)
++ length = 1; // default length is 1
++
+ while (*buf && length > 0) {
+ buf++, length--;
+ }
+ if (length > 0)
+ return 2;
+
+- /* ignore if value not found */
+- if(value == 0)
+- return 0;
+-
+ if (!ignore)
+- counter[i++]->value = valuedup(value);
++ counter[i++]->value = strndup(start, buf - start);
+ break;
+
+
+@@ -192,7 +192,7 @@
+ case '\f':
+ case '\v':
+ /* don't match if not at least one space */
+- if(!isspace(*(buf)))
++ if(!isspace(*buf))
+ return 0;
+ else
+ buf++;
+@@ -208,7 +208,7 @@
+ case '\v':
+ break;
+ default:
+- while (isspace(*(buf)))
++ while (isspace(*buf))
+ buf++;
+ }
+ fmt++;