From f79cd1a9b2111a228bbb5b6de6fb836ad515c5c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 12 Apr 2018 15:58:45 +0200 Subject: [PATCH] verify: use manager_load_startable_unit_or_warn() to load units for verification This doesn't change the outcome: (before) /home/zbyszek/src/systemd/test/test-execute/exec-basic.service:6: Executable path specifies a directory: /usr/bin/test/ exec-basic.service: Failed to create exec-basic.service/start: Unit exec-basic.service is not loaded properly: Exec format error. (after) /home/zbyszek/src/systemd/test/test-execute/exec-basic.service:6: Executable path specifies a directory: /usr/bin/test/ Failed to load file /home/zbyszek/src/systemd/test/test-execute/exec-basic.service: Exec format error (before) masked.service: Failed to create masked.service/start: Unit masked.service is masked. (after) File /home/zbyszek/src/systemd/test/test-execute/masked.service is masked. but the failure is immediate and the error messages are more direct. --- src/analyze/analyze-verify.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/analyze/analyze-verify.c b/src/analyze/analyze-verify.c index 4cdf6325524..35e2b426dde 100644 --- a/src/analyze/analyze-verify.c +++ b/src/analyze/analyze-verify.c @@ -244,7 +244,6 @@ static int verify_unit(Unit *u, bool check_man) { } int verify_units(char **filenames, UnitFileScope scope, bool check_man, bool run_generators) { - _cleanup_(sd_bus_error_free) sd_bus_error err = SD_BUS_ERROR_NULL; _cleanup_free_ char *var = NULL; Manager *m = NULL; FILE *serial = NULL; @@ -297,12 +296,10 @@ int verify_units(char **filenames, UnitFileScope scope, bool check_man, bool run continue; } - k = manager_load_unit(m, NULL, prepared, &err, &units[count]); - if (k < 0) { - log_error_errno(k, "Failed to load %s: %m", *filename); - if (r == 0) - r = k; - } else + k = manager_load_startable_unit_or_warn(m, NULL, prepared, &units[count]); + if (k < 0 && r == 0) + r = k; + else count++; }