]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
rename: stop after count changes
authorTodd Lewis <todd_lewis@unc.edu>
Thu, 15 Jul 2021 05:34:00 +0000 (01:34 -0400)
committerTodd Lewis <todd_lewis@unc.edu>
Thu, 15 Jul 2021 05:34:00 +0000 (01:34 -0400)
misc-utils/rename.c

index 3b0aed02279428815451b2a2f398e12363133d8b..4e9f40ba06e48ae78c2c2da5b31a3f15311bb4a8 100644 (file)
@@ -68,7 +68,7 @@ static int string_replace(char *from, char *to, char *s, char *orig, char **newn
        p = orig;
        *newname = xmalloc(strlen(orig) - count * fromlen + count * strlen(to) + 1);
        q = *newname;
-       while (where) {
+       while (count--) {
                while (p < where)
                        *q++ = *p++;
                p = to;