r15316: I don't understand quite why this function was ever like this, but we
authorAndrew Bartlett <abartlet@samba.org>
Sat, 29 Apr 2006 09:11:07 +0000 (09:11 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:05:11 +0000 (14:05 -0500)
need to replace every instance of the character.  Previously we
skipped the first.

Andrew Bartlett

source/lib/util/util_str.c

index 34d37ecfbdd7cf69e7cd0f90c243abb245230a0e..df9fd44cd6ba28eee8457e0d477bde86e65c1e80 100644 (file)
@@ -775,8 +775,7 @@ _PUBLIC_ int strwicmp(const char *psz1, const char *psz2)
 **/
 _PUBLIC_ void string_replace(char *s, char oldc, char newc)
 {
-       while (*s) {
-               s++;
+       for (;s && *s; s++) {
                if (*s == oldc) *s = newc;
        }
 }