]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
service: sysv - properly handle init scripts with .sh suffix
authorMichael Biebl <biebl@debian.org>
Wed, 6 Mar 2013 22:24:31 +0000 (23:24 +0100)
committerMichael Biebl <biebl@debian.org>
Wed, 6 Mar 2013 22:24:31 +0000 (23:24 +0100)
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.

src/core/service.c

index 61b150cba8e55fff42109bce0bea6e520d4e6754..3fbb0a136d185de521ea3187c47c86ba4163ed7a 100644 (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