]> git.ozlabs.org Git - petitboot/commitdiff
lib/system: Don't modify dir parameter to pb_rmdir_recursive
authorJeremy Kerr <jk@ozlabs.org>
Thu, 26 Sep 2013 02:32:18 +0000 (10:32 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Thu, 26 Sep 2013 07:13:20 +0000 (15:13 +0800)
We're modifying dir rather than cur (the local copy of dir), so the
caller-provided (const!) string is no longer const.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
lib/system/system.c

index c9fe979465239d589d5db35de8c57ed75643949e..0253ac8778e32242bf055d2a3eadbcede4ba1920 100644 (file)
@@ -91,12 +91,12 @@ int pb_rmdir_recursive(const char *base, const char *dir)
 
        cur = talloc_strdup(NULL, dir);
 
-       while (strcmp(base, dir)) {
+       while (strcmp(base, cur)) {
 
-               rmdir(dir);
+               rmdir(cur);
 
                /* null-terminate at the last slash */
-               pos = strrchr(dir, '/');
+               pos = strrchr(cur, '/');
                if (!pos)
                        break;