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:
+1
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user