Merge pull request #8626 from floppym/initctl
sysvinit-2.89 compatibility fixes
This commit is contained in:
commit
34bfb98ace
|
@ -8213,6 +8213,7 @@ static int talk_initctl(void) {
|
||||||
_cleanup_close_ int fd = -1;
|
_cleanup_close_ int fd = -1;
|
||||||
char rl;
|
char rl;
|
||||||
int r;
|
int r;
|
||||||
|
const char *p;
|
||||||
|
|
||||||
rl = action_to_runlevel();
|
rl = action_to_runlevel();
|
||||||
if (!rl)
|
if (!rl)
|
||||||
|
@ -8220,17 +8221,21 @@ static int talk_initctl(void) {
|
||||||
|
|
||||||
request.runlevel = rl;
|
request.runlevel = rl;
|
||||||
|
|
||||||
fd = open(INIT_FIFO, O_WRONLY|O_NONBLOCK|O_CLOEXEC|O_NOCTTY);
|
FOREACH_STRING(p, "/run/initctl", "/dev/initctl") {
|
||||||
|
fd = open(p, O_WRONLY|O_NONBLOCK|O_CLOEXEC|O_NOCTTY);
|
||||||
|
if (fd >= 0 || errno != ENOENT)
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
if (errno == ENOENT)
|
if (errno == ENOENT)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return log_error_errno(errno, "Failed to open "INIT_FIFO": %m");
|
return log_error_errno(errno, "Failed to open initctl fifo: %m");
|
||||||
}
|
}
|
||||||
|
|
||||||
r = loop_write(fd, &request, sizeof(request), false);
|
r = loop_write(fd, &request, sizeof(request), false);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to write to "INIT_FIFO": %m");
|
return log_error_errno(r, "Failed to write to %s: %m", p);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
|
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=/dev/initctl Compatibility Daemon
|
Description=initctl Compatibility Daemon
|
||||||
Documentation=man:systemd-initctl.service(8)
|
Documentation=man:systemd-initctl.service(8)
|
||||||
DefaultDependencies=no
|
DefaultDependencies=no
|
||||||
|
|
||||||
|
|
|
@ -8,12 +8,12 @@
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
|
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=/dev/initctl Compatibility Named Pipe
|
Description=initctl Compatibility Named Pipe
|
||||||
Documentation=man:systemd-initctl.service(8)
|
Documentation=man:systemd-initctl.service(8)
|
||||||
DefaultDependencies=no
|
DefaultDependencies=no
|
||||||
Before=sockets.target
|
Before=sockets.target
|
||||||
|
|
||||||
[Socket]
|
[Socket]
|
||||||
ListenFIFO=/run/systemd/initctl/fifo
|
ListenFIFO=/run/initctl
|
||||||
Symlinks=/dev/initctl
|
Symlinks=/dev/initctl
|
||||||
SocketMode=0600
|
SocketMode=0600
|
||||||
|
|
Loading…
Reference in New Issue