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: use sizeof() instead of strlen() on literal strings
[elogind.git]
/
src
/
service.c
diff --git
a/src/service.c
b/src/service.c
index 6539a24102d086463dffdd4f762ec13bd83b97d1..df0d4002409f8d5cf3cb5ac49087d9bf8c9790f0 100644
(file)
--- a/
src/service.c
+++ b/
src/service.c
@@
-260,7
+260,8
@@
static int sysv_translate_facility(const char *name, char **_r) {
#ifdef TARGET_FEDORA
/* Fedora extensions, lacking the $ prefix */
"MTA", SPECIAL_MAIL_TRANSFER_AGENT_TARGET,
#ifdef TARGET_FEDORA
/* Fedora extensions, lacking the $ prefix */
"MTA", SPECIAL_MAIL_TRANSFER_AGENT_TARGET,
- "smtpdaemon", SPECIAL_MAIL_TRANSFER_AGENT_TARGET
+ "smtpdaemon", SPECIAL_MAIL_TRANSFER_AGENT_TARGET,
+ "httpd", SPECIAL_HTTP_DAEMON_TARGET,
#endif
};
#endif
};
@@
-276,9
+277,11
@@
static int sysv_translate_facility(const char *name, char **_r) {
}
if (*name == '$')
}
if (*name == '$')
- return 0;
+ r = unit_name_build(name+1, NULL, ".target");
+ else
+ r = sysv_translate_name(name);
- if (!
(r = sysv_translate_name(name))
)
+ if (!
r
)
return -ENOMEM;
finish:
return -ENOMEM;
finish:
@@
-316,8
+319,8
@@
static int sysv_fix_order(Service *s) {
/* If both units have modern headers we don't care
* about the priorities */
/* If both units have modern headers we don't care
* about the priorities */
- if ((
!s->sysv
_path || s->sysv_has_lsb) &&
- (
!t->sysv
_path || t->sysv_has_lsb))
+ if ((
s->meta.fragment
_path || s->sysv_has_lsb) &&
+ (
t->meta.fragment
_path || t->sysv_has_lsb))
continue;
special_s = s->sysv_runlevels && !chars_intersect(RUNLEVELS_UP, s->sysv_runlevels);
continue;
special_s = s->sysv_runlevels && !chars_intersect(RUNLEVELS_UP, s->sysv_runlevels);
@@
-824,22
+827,6
@@
static int service_load_sysv(Service *s) {
return 0;
}
return 0;
}
-static int service_add_bus_name(Service *s) {
- char *n;
- int r;
-
- assert(s);
- assert(s->bus_name);
-
- if (asprintf(&n, "dbus-%s.service", s->bus_name) < 0)
- return 0;
-
- r = unit_merge_by_name(UNIT(s), n);
- free(n);
-
- return r;
-}
-
static int service_verify(Service *s) {
assert(s);
static int service_verify(Service *s) {
assert(s);
@@
-929,13
+916,9
@@
static int service_load(Unit *u) {
if ((r = sysv_fix_order(s)) < 0)
return r;
if ((r = sysv_fix_order(s)) < 0)
return r;
- if (s->bus_name) {
- if ((r = service_add_bus_name(s)) < 0)
- return r;
-
+ if (s->bus_name)
if ((r = unit_watch_bus_name(u, s->bus_name)) < 0)
return r;
if ((r = unit_watch_bus_name(u, s->bus_name)) < 0)
return r;
- }
if (s->type == SERVICE_NOTIFY && s->notify_access == NOTIFY_NONE)
s->notify_access = NOTIFY_MAIN;
if (s->type == SERVICE_NOTIFY && s->notify_access == NOTIFY_NONE)
s->notify_access = NOTIFY_MAIN;
@@
-2297,7
+2280,7
@@
static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) {
assert(s);
assert(pid >= 0);
assert(s);
assert(pid >= 0);
- if (
s->sysv
_path)
+ if (
!s->meta.fragment
_path)
success = is_clean_exit_lsb(code, status);
else
success = is_clean_exit(code, status);
success = is_clean_exit_lsb(code, status);
else
success = is_clean_exit(code, status);
@@
-2747,11
+2730,12
@@
static int service_enumerate(Manager *m) {
if (de->d_name[0] == 'S') {
if (de->d_name[0] == 'S') {
- SERVICE(service)->sysv_start_priority =
- MAX(a*10 + b, SERVICE(service)->sysv_start_priority);
+ if (rcnd_table[i].type == RUNLEVEL_UP || rcnd_table[i].type == RUNLEVEL_SYSINIT) {
+ SERVICE(service)->sysv_start_priority =
+ MAX(a*10 + b, SERVICE(service)->sysv_start_priority);
- if (rcnd_table[i].type == RUNLEVEL_UP || rcnd_table[i].type == RUNLEVEL_SYSINIT)
SERVICE(service)->sysv_enabled = true;
SERVICE(service)->sysv_enabled = true;
+ }
if ((r = set_ensure_allocated(&runlevel_services[i], trivial_hash_func, trivial_compare_func)) < 0)
goto finish;
if ((r = set_ensure_allocated(&runlevel_services[i], trivial_hash_func, trivial_compare_func)) < 0)
goto finish;