From: Jeremy Kerr Date: Thu, 26 Sep 2013 02:32:18 +0000 (+0800) Subject: lib/system: Don't modify dir parameter to pb_rmdir_recursive X-Git-Tag: v1.0.0~416 X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=commitdiff_plain;h=2e97d0eea0d8a480877a1aabb4c67ad1aad59ed1 lib/system: Don't modify dir parameter to pb_rmdir_recursive 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 --- diff --git a/lib/system/system.c b/lib/system/system.c index c9fe979..0253ac8 100644 --- a/lib/system/system.c +++ b/lib/system/system.c @@ -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;