]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
fix string replace.
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>
Sat, 10 Dec 2011 21:45:37 +0000 (19:45 -0200)
committerGustavo Sverzut Barbieri <barbieri@profusion.mobi>
Sun, 11 Dec 2011 22:58:21 +0000 (20:58 -0200)
configure files with this would fail:

options wl x=1

were being handled as " =1".

libkmod/libkmod-util.c

index 2e58c91e1d3fb368267821b19f5a5b84f05af043..9a68a3e236c154d12391b2382b23aa71ef2b4481 100644 (file)
@@ -208,10 +208,9 @@ int read_str_ulong(int fd, unsigned long *value, int base) {
 char *strchr_replace(char *s, int c, char r)
 {
        char *p;
-
-       for (p = s; p != NULL; p = strchr(p, c))
-               *p = r;
-
+       for (p = s; *p != '\0'; p++)
+               if (*p == c)
+                       *p = r;
        return s;
 }