diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-06-19 23:29:19 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-06-19 23:29:19 +0200 |
commit | 6d946490ba835807327b36263c7a3b53653ca762 (patch) | |
tree | 09e06ebfbabb1f13fb9faa61314c87f82079e2a0 /src/delta/delta.c | |
parent | sd-resolve: suppress false positive MSan warnings (diff) | |
download | systemd-6d946490ba835807327b36263c7a3b53653ca762.tar.xz systemd-6d946490ba835807327b36263c7a3b53653ca762.zip |
tree-wide: drop alloca() in loop
Diffstat (limited to 'src/delta/delta.c')
-rw-r--r-- | src/delta/delta.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/delta/delta.c b/src/delta/delta.c index 63baa74794..08d8867431 100644 --- a/src/delta/delta.c +++ b/src/delta/delta.c @@ -371,7 +371,7 @@ static int enumerate_dir( return 0; } -static bool should_skip_path(const char *prefix, const char *suffix) { +static int should_skip_path(const char *prefix, const char *suffix) { #if HAVE_SPLIT_USR _cleanup_free_ char *target = NULL; const char *p; @@ -383,10 +383,16 @@ static bool should_skip_path(const char *prefix, const char *suffix) { return false; NULSTR_FOREACH(p, prefixes) { + _cleanup_free_ char *tmp = NULL; + if (path_startswith(dirname, p)) continue; - if (path_equal(target, strjoina(p, "/", suffix))) { + tmp = path_join(p, suffix); + if (!tmp) + return -ENOMEM; + + if (path_equal(target, tmp)) { log_debug("%s redirects to %s, skipping.", dirname, target); return true; } @@ -423,7 +429,7 @@ static int process_suffix(const char *suffix, const char *onlyprefix) { NULSTR_FOREACH(p, prefixes) { _cleanup_free_ char *t = NULL; - if (should_skip_path(p, suffix)) + if (should_skip_path(p, suffix) > 0) continue; t = strjoin(p, "/", suffix); |