diff options
Diffstat (limited to 'src/analyze/analyze-verify.c')
-rw-r--r-- | src/analyze/analyze-verify.c | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/src/analyze/analyze-verify.c b/src/analyze/analyze-verify.c index 4145812bc7..e7df55f5a5 100644 --- a/src/analyze/analyze-verify.c +++ b/src/analyze/analyze-verify.c @@ -72,8 +72,7 @@ static int verify_socket(Unit *u) { /* This makes sure instance is created if necessary. */ r = socket_instantiate_service(SOCKET(u)); if (r < 0) { - log_unit_error(u->id, "Socket %s cannot be started, failed to create instance.", - u->id); + log_unit_error_errno(u, r, "Socket cannot be started, failed to create instance: %m"); return r; } @@ -82,11 +81,10 @@ static int verify_socket(Unit *u) { Service *service; service = SERVICE(UNIT_DEREF(SOCKET(u)->service)); - log_unit_debug(u->id, "%s uses %s", u->id, UNIT(service)->id); + log_unit_debug(u, "Using %s", UNIT(service)->id); if (UNIT(service)->load_state != UNIT_LOADED) { - log_unit_error(u->id, "Service %s not loaded, %s cannot be started.", - UNIT(service)->id, u->id); + log_unit_error(u, "Service %s not loaded, %s cannot be started.", UNIT(service)->id, u->id); return -ENOENT; } } @@ -98,11 +96,8 @@ static int verify_executable(Unit *u, ExecCommand *exec) { if (exec == NULL) return 0; - if (access(exec->path, X_OK) < 0) { - log_unit_error(u->id, "%s: command %s is not executable: %m", - u->id, exec->path); - return -errno; - } + if (access(exec->path, X_OK) < 0) + return log_unit_error_errno(u, errno, "Command %s is not executable: %m", exec->path); return 0; } @@ -143,16 +138,15 @@ static int verify_documentation(Unit *u, bool check_man) { int r = 0, k; STRV_FOREACH(p, u->documentation) { - log_unit_debug(u->id, "%s: found documentation item %s.", u->id, *p); + log_unit_debug(u, "Found documentation item: %s", *p); + if (check_man && startswith(*p, "man:")) { k = show_man_page(*p + 4, true); if (k != 0) { if (k < 0) - log_unit_error(u->id, "%s: can't show %s: %s", - u->id, *p, strerror(-r)); + log_unit_error_errno(u, r, "Can't show %s: %m", *p); else { - log_unit_error(u->id, "%s: man %s command failed with code %d", - u->id, *p + 4, k); + log_unit_error_errno(u, r, "man %s command failed with code %d", *p + 4, k); k = -ENOEXEC; } if (r == 0) @@ -176,14 +170,12 @@ static int verify_unit(Unit *u, bool check_man) { if (log_get_max_level() >= LOG_DEBUG) unit_dump(u, stdout, "\t"); - log_unit_debug(u->id, "Creating %s/start job", u->id); + log_unit_debug(u, "Creating %s/start job", u->id); r = manager_add_job(u->manager, JOB_START, u, JOB_REPLACE, false, &err, &j); if (sd_bus_error_is_set(&err)) - log_unit_error(u->id, "Error: %s: %s", - err.name, err.message); + log_unit_error(u, "Error: %s: %s", err.name, err.message); if (r < 0) - log_unit_error(u->id, "Failed to create %s/start: %s", - u->id, strerror(-r)); + log_unit_error_errno(u, r, "Failed to create %s/start: %m", u->id); k = verify_socket(u); if (k < 0 && r == 0) |