X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fservice.c;h=07b6e4e05a5dda9d3131b43e83050a1f029414e7;hp=2515cd305f2e7686a78b54daf329cb9572a9bdd3;hb=967d86b5cbc39f2b6edeea7ae109dbfcaaf4f006;hpb=56d748b47e289fc0fcdf7925df1580afbc2d220a diff --git a/src/service.c b/src/service.c index 2515cd305..07b6e4e05 100644 --- a/src/service.c +++ b/src/service.c @@ -57,7 +57,7 @@ static const struct { { "rc5.d", SPECIAL_RUNLEVEL5_TARGET, RUNLEVEL_UP }, { "rc6.d", SPECIAL_RUNLEVEL6_TARGET, RUNLEVEL_DOWN }, - /* SuSE style boot.d */ + /* SUSE style boot.d */ { "boot.d", SPECIAL_BASIC_TARGET, RUNLEVEL_BASIC }, /* Debian style rcS.d */ @@ -649,6 +649,12 @@ static int service_load_sysv_name(Service *s, const char *name) { assert(s); assert(name); + /* For SysV services we strip the boot. or .sh + * prefixes/suffixes. */ + if (startswith(name, "boot.") || + endswith(name, ".sh.service")) + return -ENOENT; + STRV_FOREACH(p, UNIT(s)->meta.manager->sysvinit_path) { char *path; int r; @@ -662,7 +668,7 @@ static int service_load_sysv_name(Service *s, const char *name) { r = service_load_sysv_path(s, path); if (r >= 0 && UNIT(s)->meta.load_state == UNIT_STUB) { - /* Try Debian style .sh source'able init scripts */ + /* Try Debian style xxx.sh source'able init scripts */ strcat(path, ".sh"); r = service_load_sysv_path(s, path); } @@ -670,7 +676,7 @@ static int service_load_sysv_name(Service *s, const char *name) { free(path); if (r >= 0 && UNIT(s)->meta.load_state == UNIT_STUB) { - /* Try Suse style boot.xxxx init scripts */ + /* Try SUSE style boot.xxx init scripts */ if (asprintf(&path, "%s/boot.%s", *p, name) < 0) return -ENOMEM; @@ -1702,7 +1708,8 @@ static int service_start(Unit *u) { /* Make sure we don't enter a busy loop of some kind. */ if (!ratelimit_test(&s->ratelimit)) { log_warning("%s start request repeated too quickly, refusing to start.", u->meta.id); - return -EAGAIN; + service_enter_dead(s, false, true); + return -ECANCELED; } s->failure = false;