summaryrefslogtreecommitdiffstats
path: root/src/analyze/analyze-verify-util.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2023-11-23 21:20:07 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2023-11-23 21:20:13 +0100
commitff7af46edb51c6548876e139c89389a388694051 (patch)
tree07a2fcac89d628760351bdc0ada0b80d52fdfde5 /src/analyze/analyze-verify-util.c
parentanalyze: shorten code a bit (diff)
downloadsystemd-ff7af46edb51c6548876e139c89389a388694051.tar.xz
systemd-ff7af46edb51c6548876e139c89389a388694051.zip
analyze: set SYSTEMD_UNIT_PATH in verify_generate_path()
Then, rename verify_generate_path() -> verify_set_unit_path().
Diffstat (limited to 'src/analyze/analyze-verify-util.c')
-rw-r--r--src/analyze/analyze-verify-util.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/analyze/analyze-verify-util.c b/src/analyze/analyze-verify-util.c
index 54442d06a9..cfafbd4d44 100644
--- a/src/analyze/analyze-verify-util.c
+++ b/src/analyze/analyze-verify-util.c
@@ -72,7 +72,7 @@ int verify_prepare_filename(const char *filename, char **ret) {
return 0;
}
-int verify_generate_path(char **ret, char **filenames) {
+int verify_set_unit_path(char **filenames) {
_cleanup_strv_free_ char **ans = NULL;
_cleanup_free_ char *joined = NULL;
const char *old;
@@ -107,7 +107,7 @@ int verify_generate_path(char **ret, char **filenames) {
!strextend_with_separator(&joined, ":", old ?: ""))
return -ENOMEM;
- *ret = TAKE_PTR(joined);
+ assert_se(set_unit_path(joined) >= 0);
return 0;
}
@@ -242,7 +242,6 @@ int verify_units(
_cleanup_(set_destroy_ignore_pointer_max) Set *s = NULL;
_unused_ _cleanup_(clear_log_syntax_callback) dummy_t dummy;
Unit *units[strv_length(filenames)];
- _cleanup_free_ char *var = NULL;
int r, k, count = 0;
if (strv_isempty(filenames))
@@ -254,11 +253,9 @@ int verify_units(
set_log_syntax_callback(log_syntax_callback, &s);
/* set the path */
- r = verify_generate_path(&var, filenames);
+ r = verify_set_unit_path(filenames);
if (r < 0)
- return log_error_errno(r, "Failed to generate unit load path: %m");
-
- assert_se(set_unit_path(var) >= 0);
+ return log_error_errno(r, "Failed to set unit load path: %m");
r = manager_new(scope, flags, &m);
if (r < 0)