diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-06-20 06:29:19 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-06-20 06:29:19 +0900 |
commit | 6d946490ba835807327b36263c7a3b53653ca762 (patch) | |
tree | 09e06ebfbabb1f13fb9faa61314c87f82079e2a0 /src/delta | |
parent | f9dc94408d70dd2f44915f4c6d67dc498c1c6243 (diff) | |
download | systemd-6d946490ba835807327b36263c7a3b53653ca762.tar.gz systemd-6d946490ba835807327b36263c7a3b53653ca762.tar.bz2 systemd-6d946490ba835807327b36263c7a3b53653ca762.zip |
tree-wide: drop alloca() in loop
Diffstat (limited to 'src/delta')
-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); |