From: Michael Biebl Date: Wed, 6 Mar 2013 22:24:31 +0000 (+0100) Subject: service: sysv - properly handle init scripts with .sh suffix X-Git-Tag: v198~48 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=11dac832c75cbdd0015fb0417b9877396ea57f6f;p=elogind.git service: sysv - properly handle init scripts with .sh suffix Dropping the distribution specific #ifdefs in 88516c0c952b9502e8ef1d6a1481af61b0fb422d broke the .sh suffix stripping since we now always used the else clause of the rc. check. We eventually want to drop the rc. prefix stripping, but for now we assume that no sysv init script uses both an rc. prefix and .sh suffix, so make the check for the .sh suffix and rc. prefix mutually exclusive. --- diff --git a/src/core/service.c b/src/core/service.c index 61b150cba..3fbb0a136 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -331,7 +331,7 @@ static char *sysv_translate_name(const char *name) { if (endswith(name, ".sh")) /* Drop .sh suffix */ strcpy(stpcpy(r, name) - 3, ".service"); - if (startswith(name, "rc.")) + else if (startswith(name, "rc.")) /* Drop rc. prefix */ strcpy(stpcpy(r, name + 3), ".service"); else