Commit f63b493e authored by Michael Stapelberg's avatar Michael Stapelberg Committed by Michael Stapelberg

Run update-rc.d defaults before update-rc.d <enable|disable>

Closes: #722523
parent fd3b3f72
......@@ -4087,8 +4087,53 @@ static int enable_sysv_units(char **args) {
log_info("Synchronizing state for %s with sysvinit using update-rc.d...", name);
/* Run update-rc.d <file> defaults first to ensure the K- and
* S-symlinks are present. If they are missing, update-rc.d
* <enable|disable> will fail. See
* http://bugs.debian.org/722523 */
argv[c++] = path_get_file_name(p);
argv[c++] = verb;
argv[c++] = "defaults";
argv[c] = NULL;
l = strv_join((char**)argv, " ");
if (!l) {
r = log_oom();
goto finish;
}
log_info("Executing %s", l);
free(l);
pid = fork();
if (pid < 0) {
log_error("Failed to fork: %m");
r = -errno;
goto finish;
} else if (pid == 0) {
/* Child */
execv(argv[0], (char**) argv);
_exit(EXIT_FAILURE);
}
j = wait_for_terminate(pid, &status);
if (j < 0) {
log_error("Failed to wait for child: %s", strerror(-r));
r = j;
goto finish;
}
if (status.si_code == CLD_EXITED) {
if (status.si_status != 0) {
r = -EINVAL;
goto finish;
}
} else {
r = -EPROTO;
goto finish;
}
argv[c-1] = verb;
argv[c] = NULL;
l = strv_join((char**)argv, " ");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment