chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
systemctl: fix a leak
[elogind.git]
/
src
/
core
/
service.c
diff --git
a/src/core/service.c
b/src/core/service.c
index a55be8f3ac7827707bc915a295d39e975e1a2c60..53a2935e52d04bd4d6857def6c79e6278b82229b 100644
(file)
--- a/
src/core/service.c
+++ b/
src/core/service.c
@@
-209,7
+209,7
@@
static void service_start_watchdog(Service *s) {
if (s->watchdog_event_source) {
r = sd_event_source_set_time(s->watchdog_event_source, s->watchdog_timestamp.monotonic + s->watchdog_usec);
if (r < 0) {
if (s->watchdog_event_source) {
r = sd_event_source_set_time(s->watchdog_event_source, s->watchdog_timestamp.monotonic + s->watchdog_usec);
if (r < 0) {
- log_unit_warning
(UNIT(s)->id, "%s failed to reset watchdog timer: %s", UNIT(s)->id, strerror(-r)
);
+ log_unit_warning
_errno(UNIT(s)->id, r, "%s failed to reset watchdog timer: %m", UNIT(s)->id
);
return;
}
return;
}
@@
-222,7
+222,7
@@
static void service_start_watchdog(Service *s) {
s->watchdog_timestamp.monotonic + s->watchdog_usec, 0,
service_dispatch_watchdog, s);
if (r < 0) {
s->watchdog_timestamp.monotonic + s->watchdog_usec, 0,
service_dispatch_watchdog, s);
if (r < 0) {
- log_unit_warning
(UNIT(s)->id, "%s failed to add watchdog timer: %s", UNIT(s)->id, strerror(-r)
);
+ log_unit_warning
_errno(UNIT(s)->id, r, "%s failed to add watchdog timer: %m", UNIT(s)->id
);
return;
}
return;
}
@@
-232,7
+232,7
@@
static void service_start_watchdog(Service *s) {
}
if (r < 0)
}
if (r < 0)
- log_unit_warning
(UNIT(s)->id, "%s failed to install watchdog timer: %s", UNIT(s)->id, strerror(-r)
);
+ log_unit_warning
_errno(UNIT(s)->id, r, "%s failed to install watchdog timer: %m", UNIT(s)->id
);
}
static void service_reset_watchdog(Service *s) {
}
static void service_reset_watchdog(Service *s) {
@@
-546,13
+546,6
@@
static void service_dump(Unit *u, FILE *f, const char *prefix) {
exec_command_dump_list(s->exec_command[c], f, prefix2);
}
exec_command_dump_list(s->exec_command[c], f, prefix2);
}
-#ifdef HAVE_SYSV_COMPAT
- if (s->sysv_start_priority >= 0)
- fprintf(f,
- "%sSysVStartPriority: %i\n",
- prefix, s->sysv_start_priority);
-#endif
-
if (s->status_text)
fprintf(f, "%sStatus Text: %s\n",
prefix, s->status_text);
if (s->status_text)
fprintf(f, "%sStatus Text: %s\n",
prefix, s->status_text);
@@
-578,7
+571,7
@@
static int service_load_pid_file(Service *s, bool may_warn) {
r = parse_pid(k, &pid);
if (r < 0) {
if (may_warn)
r = parse_pid(k, &pid);
if (r < 0) {
if (may_warn)
- log_unit_info
(UNIT(s)->id, "Failed to read PID from file %s: %s", s->pid_file, strerror(-r)
);
+ log_unit_info
_errno(UNIT(s)->id, r, "Failed to read PID from file %s: %m", s->pid_file
);
return r;
}
return r;
}
@@
-1130,7
+1123,7
@@
static void service_enter_dead(Service *s, ServiceResult f, bool allow_restart)
return;
fail:
return;
fail:
- log_unit_warning
(UNIT(s)->id, "%s failed to run install restart timer: %s", UNIT(s)->id, strerror(-r)
);
+ log_unit_warning
_errno(UNIT(s)->id, r, "%s failed to run install restart timer: %m", UNIT(s)->id
);
service_enter_dead(s, SERVICE_FAILURE_RESOURCES, false);
}
service_enter_dead(s, SERVICE_FAILURE_RESOURCES, false);
}
@@
-1167,7
+1160,7
@@
static void service_enter_stop_post(Service *s, ServiceResult f) {
return;
fail:
return;
fail:
- log_unit_warning
(UNIT(s)->id, "%s failed to run 'stop-post' task: %s", UNIT(s)->id, strerror(-r)
);
+ log_unit_warning
_errno(UNIT(s)->id, r, "%s failed to run 'stop-post' task: %m", UNIT(s)->id
);
service_enter_signal(s, SERVICE_FINAL_SIGTERM, SERVICE_FAILURE_RESOURCES);
}
service_enter_signal(s, SERVICE_FINAL_SIGTERM, SERVICE_FAILURE_RESOURCES);
}
@@
-1213,7
+1206,7
@@
static void service_enter_signal(Service *s, ServiceState state, ServiceResult f
return;
fail:
return;
fail:
- log_unit_warning
(UNIT(s)->id, "%s failed to kill processes: %s", UNIT(s)->id, strerror(-r)
);
+ log_unit_warning
_errno(UNIT(s)->id, r, "%s failed to kill processes: %m", UNIT(s)->id
);
if (state == SERVICE_STOP_SIGTERM || state == SERVICE_STOP_SIGKILL ||
state == SERVICE_STOP_SIGABRT)
if (state == SERVICE_STOP_SIGTERM || state == SERVICE_STOP_SIGKILL ||
state == SERVICE_STOP_SIGABRT)
@@
-1268,7
+1261,7
@@
static void service_enter_stop(Service *s, ServiceResult f) {
return;
fail:
return;
fail:
- log_unit_warning
(UNIT(s)->id, "%s failed to run 'stop' task: %s", UNIT(s)->id, strerror(-r)
);
+ log_unit_warning
_errno(UNIT(s)->id, r, "%s failed to run 'stop' task: %m", UNIT(s)->id
);
service_enter_signal(s, SERVICE_STOP_SIGTERM, SERVICE_FAILURE_RESOURCES);
}
service_enter_signal(s, SERVICE_STOP_SIGTERM, SERVICE_FAILURE_RESOURCES);
}
@@
-1330,7
+1323,7
@@
static void service_enter_start_post(Service *s) {
return;
fail:
return;
fail:
- log_unit_warning
(UNIT(s)->id, "%s failed to run 'start-post' task: %s", UNIT(s)->id, strerror(-r)
);
+ log_unit_warning
_errno(UNIT(s)->id, r, "%s failed to run 'start-post' task: %m", UNIT(s)->id
);
service_enter_stop(s, SERVICE_FAILURE_RESOURCES);
}
service_enter_stop(s, SERVICE_FAILURE_RESOURCES);
}
@@
-1423,7
+1416,7
@@
static void service_enter_start(Service *s) {
return;
fail:
return;
fail:
- log_unit_warning
(UNIT(s)->id, "%s failed to run 'start' task: %s", UNIT(s)->id, strerror(-r)
);
+ log_unit_warning
_errno(UNIT(s)->id, r, "%s failed to run 'start' task: %m", UNIT(s)->id
);
service_enter_signal(s, SERVICE_FINAL_SIGTERM, SERVICE_FAILURE_RESOURCES);
}
service_enter_signal(s, SERVICE_FINAL_SIGTERM, SERVICE_FAILURE_RESOURCES);
}
@@
-1461,7
+1454,7
@@
static void service_enter_start_pre(Service *s) {
return;
fail:
return;
fail:
- log_unit_warning
(UNIT(s)->id, "%s failed to run 'start-pre' task: %s", UNIT(s)->id, strerror(-r)
);
+ log_unit_warning
_errno(UNIT(s)->id, r, "%s failed to run 'start-pre' task: %m", UNIT(s)->id
);
service_enter_dead(s, SERVICE_FAILURE_RESOURCES, true);
}
service_enter_dead(s, SERVICE_FAILURE_RESOURCES, true);
}
@@
-1541,7
+1534,7
@@
static void service_enter_reload(Service *s) {
return;
fail:
return;
fail:
- log_unit_warning
(UNIT(s)->id, "%s failed to run 'reload' task: %s", UNIT(s)->id, strerror(-r)
);
+ log_unit_warning
_errno(UNIT(s)->id, r, "%s failed to run 'reload' task: %m", UNIT(s)->id
);
s->reload_result = SERVICE_FAILURE_RESOURCES;
service_enter_running(s, SERVICE_SUCCESS);
}
s->reload_result = SERVICE_FAILURE_RESOURCES;
service_enter_running(s, SERVICE_SUCCESS);
}
@@
-1574,7
+1567,7
@@
static void service_run_next_control(Service *s) {
return;
fail:
return;
fail:
- log_unit_warning
(UNIT(s)->id, "%s failed to run next control task: %s", UNIT(s)->id, strerror(-r)
);
+ log_unit_warning
_errno(UNIT(s)->id, r, "%s failed to run next control task: %m", UNIT(s)->id
);
if (s->state == SERVICE_START_PRE)
service_enter_signal(s, SERVICE_FINAL_SIGTERM, SERVICE_FAILURE_RESOURCES);
if (s->state == SERVICE_START_PRE)
service_enter_signal(s, SERVICE_FINAL_SIGTERM, SERVICE_FAILURE_RESOURCES);
@@
-1618,7
+1611,7
@@
static void service_run_next_main(Service *s) {
return;
fail:
return;
fail:
- log_unit_warning
(UNIT(s)->id, "%s failed to run next main task: %s", UNIT(s)->id, strerror(-r)
);
+ log_unit_warning
_errno(UNIT(s)->id, r, "%s failed to run next main task: %m", UNIT(s)->id
);
service_enter_stop(s, SERVICE_FAILURE_RESOURCES);
}
service_enter_stop(s, SERVICE_FAILURE_RESOURCES);
}
@@
-2031,7
+2024,7
@@
static int service_watch_pid_file(Service *s) {
return 0;
fail:
return 0;
fail:
- log_unit_error
(UNIT(s)->id, "Failed to set a watch for %s's PID file %s: %s", UNIT(s)->id, s->pid_file_pathspec->path, strerror(-r)
);
+ log_unit_error
_errno(UNIT(s)->id, r, "Failed to set a watch for %s's PID file %s: %m", UNIT(s)->id, s->pid_file_pathspec->path
);
service_unwatch_pid_file(s);
return r;
}
service_unwatch_pid_file(s);
return r;
}