service: sysv - properly handle init scripts with .sh suffix

Dropping the distribution specific #ifdefs in
88516c0c95 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.
This commit is contained in:
Michael Biebl 2013-03-06 23:24:31 +01:00
parent 9304ef91c5
commit 11dac832c7

View file

@ -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