[systemd-commits] 7 commits - src/core src/journal src/login src/nspawn src/update-utmp units/proc-sys-fs-binfmt_misc.automount units/systemd-binfmt.service.in
Lennart Poettering
lennart at kemper.freedesktop.org
Fri Apr 13 10:03:59 PDT 2012
src/core/loopback-setup.c | 73 +++++++++--
src/core/main.c | 6
src/core/manager.c | 24 +--
src/journal/journald.c | 1
src/login/logind.c | 14 +-
src/nspawn/nspawn.c | 206 +++++++++++++++++++++++++-------
src/update-utmp/update-utmp.c | 9 -
units/proc-sys-fs-binfmt_misc.automount | 3
units/systemd-binfmt.service.in | 1
9 files changed, 254 insertions(+), 83 deletions(-)
New commits:
commit 74afee9c18fe74035387e4e17ca60c6b51ee9af3
Author: Lennart Poettering <lennart at poettering.net>
Date: Fri Apr 13 17:54:33 2012 +0200
logind: explicitly check for /dev/tty0
diff --git a/src/login/logind.c b/src/login/logind.c
index 6711740..fc08c4b 100644
--- a/src/login/logind.c
+++ b/src/login/logind.c
@@ -945,14 +945,16 @@ static int manager_connect_console(Manager *m) {
assert(m);
assert(m->console_active_fd < 0);
+ /* On certain architectures (S390 and Xen, and containers),
+ /dev/tty0 does not exist, so don't fail if we can't open
+ it. */
+ if (access("/dev/tty0", F_OK) < 0) {
+ m->console_active_fd = -1;
+ return 0;
+ }
+
m->console_active_fd = open("/sys/class/tty/tty0/active", O_RDONLY|O_NOCTTY|O_CLOEXEC);
if (m->console_active_fd < 0) {
-
- /* On certain architectures (S390 and Xen), /dev/tty0
- does not exist, so don't fail if we can't open it.*/
- if (errno == ENOENT)
- return 0;
-
log_error("Failed to open /sys/class/tty/tty0/active: %m");
return -errno;
}
commit 41807efb1594ae8e71e0255e154ea7d17be2251a
Author: Lennart Poettering <lennart at poettering.net>
Date: Fri Apr 13 17:39:37 2012 +0200
units: do binfmt magic only when /proc/sys is writable
diff --git a/units/proc-sys-fs-binfmt_misc.automount b/units/proc-sys-fs-binfmt_misc.automount
index 6edd1f5..658b55d 100644
--- a/units/proc-sys-fs-binfmt_misc.automount
+++ b/units/proc-sys-fs-binfmt_misc.automount
@@ -9,7 +9,8 @@
Description=Arbitrary Executable File Formats File System Automount Point
DefaultDependencies=no
Before=sysinit.target
-ConditionPathExists=/proc/sys/fs/binfmt_misc
+ConditionPathExists=/proc/sys/fs/binfmt_misc/
+ConditionPathIsReadWrite=/proc/sys/
[Automount]
Where=/proc/sys/fs/binfmt_misc
diff --git a/units/systemd-binfmt.service.in b/units/systemd-binfmt.service.in
index 267d5c3..8d28806 100644
--- a/units/systemd-binfmt.service.in
+++ b/units/systemd-binfmt.service.in
@@ -11,6 +11,7 @@ DefaultDependencies=no
Conflicts=shutdown.target
After=systemd-readahead-collect.service systemd-readahead-replay.service proc-sys-fs-binfmt_misc.automount
Before=sysinit.target shutdown.target
+ConditionPathIsReadWrite=/proc/sys/
ConditionDirectoryNotEmpty=|/usr/lib/binfmt.d
ConditionDirectoryNotEmpty=|/usr/local/lib/binfmt.d
ConditionDirectoryNotEmpty=|/etc/binfmt.d
commit 9f28b98ec6461b4e06edd1e149c1ee5e9dcc4be0
Author: Lennart Poettering <lennart at poettering.net>
Date: Fri Apr 13 17:36:41 2012 +0200
main: unset some more env vars
diff --git a/src/core/main.c b/src/core/main.c
index 9db83aa..9bcedbe 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1350,6 +1350,12 @@ int main(int argc, char *argv[]) {
unsetenv("SHLVL");
unsetenv("_");
+ /* When we are invoked by a tool chroot-like such as
+ * nspawn, these might be set, but make little sense
+ * to pass on */
+ unsetenv("USER");
+ unsetenv("LOGNAME");
+
/* All other variables are left as is, so that clients
* can still read them via /proc/1/environ */
}
commit 44785992c3c32e6abbf9d9345e0d68d579ef165b
Author: Lennart Poettering <lennart at poettering.net>
Date: Fri Apr 13 17:17:56 2012 +0200
audit: ignore if we get EPERM
if auditing access is not available, then don't complain about it, in
order to play nice with systems lacking CAP_SYS_AUDIT
diff --git a/src/core/manager.c b/src/core/manager.c
index 869c99f..1d32adf 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -2611,17 +2611,13 @@ void manager_send_unit_audit(Manager *m, Unit *u, int type, bool success) {
}
if (audit_log_user_comm_message(m->audit_fd, type, "", p, NULL, NULL, NULL, success) < 0) {
- log_warning("Failed to send audit message: %m");
-
if (errno == EPERM) {
/* We aren't allowed to send audit messages?
- * Then let's not retry again, to avoid
- * spamming the user with the same and same
- * messages over and over. */
-
+ * Then let's not retry again. */
audit_close(m->audit_fd);
m->audit_fd = -1;
- }
+ } else
+ log_warning("Failed to send audit message: %m");
}
free(p);
diff --git a/src/update-utmp/update-utmp.c b/src/update-utmp/update-utmp.c
index ec07b92..ee9105b 100644
--- a/src/update-utmp/update-utmp.c
+++ b/src/update-utmp/update-utmp.c
@@ -250,7 +250,8 @@ static int on_reboot(Context *c) {
#ifdef HAVE_AUDIT
if (c->audit_fd >= 0)
- if (audit_log_user_message(c->audit_fd, AUDIT_SYSTEM_BOOT, "init", NULL, NULL, NULL, 1) < 0) {
+ if (audit_log_user_message(c->audit_fd, AUDIT_SYSTEM_BOOT, "init", NULL, NULL, NULL, 1) < 0 &&
+ errno != EPERM) {
log_error("Failed to send audit message: %m");
r = -errno;
}
@@ -278,7 +279,8 @@ static int on_shutdown(Context *c) {
#ifdef HAVE_AUDIT
if (c->audit_fd >= 0)
- if (audit_log_user_message(c->audit_fd, AUDIT_SYSTEM_SHUTDOWN, "init", NULL, NULL, NULL, 1) < 0) {
+ if (audit_log_user_message(c->audit_fd, AUDIT_SYSTEM_SHUTDOWN, "init", NULL, NULL, NULL, 1) < 0 &&
+ errno != EPERM) {
log_error("Failed to send audit message: %m");
r = -errno;
}
@@ -330,7 +332,8 @@ static int on_runlevel(Context *c) {
runlevel > 0 ? runlevel : 'N') < 0)
return -ENOMEM;
- if (audit_log_user_message(c->audit_fd, AUDIT_SYSTEM_RUNLEVEL, s, NULL, NULL, NULL, 1) < 0) {
+ if (audit_log_user_message(c->audit_fd, AUDIT_SYSTEM_RUNLEVEL, s, NULL, NULL, NULL, 1) < 0 &&
+ errno != EPERM) {
log_error("Failed to send audit message: %m");
r = -errno;
}
commit 2c3ff76eb004d71a70cb5e253cbca7332c53ac09
Author: Lennart Poettering <lennart at poettering.net>
Date: Fri Apr 13 17:10:21 2012 +0200
loopback: handle EPERM more gracefully
diff --git a/src/core/loopback-setup.c b/src/core/loopback-setup.c
index 46c1fc8..065b75a 100644
--- a/src/core/loopback-setup.c
+++ b/src/core/loopback-setup.c
@@ -61,7 +61,8 @@ static ssize_t sendto_loop(int fd, const void *buf, size_t buf_len, int flags, c
for (;;) {
ssize_t l;
- if ((l = sendto(fd, buf, buf_len, flags, sa, sa_len)) >= 0)
+ l = sendto(fd, buf, buf_len, flags, sa, sa_len);
+ if (l >= 0)
return l;
if (errno != EINTR)
@@ -74,7 +75,8 @@ static ssize_t recvfrom_loop(int fd, void *buf, size_t buf_len, int flags, struc
for (;;) {
ssize_t l;
- if ((l = recvfrom(fd, buf, buf_len, flags, sa, sa_len)) >= 0)
+ l = recvfrom(fd, buf, buf_len, flags, sa, sa_len);
+ if (l >= 0)
return l;
if (errno != EINTR)
@@ -112,7 +114,8 @@ static int add_adresses(int fd, int if_loopback, unsigned *requests) {
ifaddrmsg->ifa_scope = RT_SCOPE_HOST;
ifaddrmsg->ifa_index = if_loopback;
- if ((r = add_rtattr(&request.header, sizeof(request), IFA_LOCAL, &ipv4_address, sizeof(ipv4_address))) < 0)
+ r = add_rtattr(&request.header, sizeof(request), IFA_LOCAL, &ipv4_address, sizeof(ipv4_address));
+ if (r < 0)
return r;
zero(sa);
@@ -131,7 +134,8 @@ static int add_adresses(int fd, int if_loopback, unsigned *requests) {
ifaddrmsg->ifa_family = AF_INET6;
ifaddrmsg->ifa_prefixlen = 128;
- if ((r = add_rtattr(&request.header, sizeof(request), IFA_LOCAL, &in6addr_loopback, sizeof(in6addr_loopback))) < 0)
+ r = add_rtattr(&request.header, sizeof(request), IFA_LOCAL, &in6addr_loopback, sizeof(in6addr_loopback));
+ if (r < 0)
return r;
if (sendto_loop(fd, &request, request.header.nlmsg_len, 0, &sa.sa, sizeof(sa)) < 0)
@@ -193,7 +197,8 @@ static int read_response(int fd, unsigned requests_max) {
socklen_t sa_len = sizeof(sa);
struct nlmsgerr *nlmsgerr;
- if ((l = recvfrom_loop(fd, &response, sizeof(response), 0, &sa.sa, &sa_len)) < 0)
+ l = recvfrom_loop(fd, &response, sizeof(response), 0, &sa.sa, &sa_len);
+ if (l < 0)
return -errno;
if (sa_len != sizeof(sa.nl) ||
@@ -217,50 +222,88 @@ static int read_response(int fd, unsigned requests_max) {
nlmsgerr = NLMSG_DATA(&response.header);
- if (nlmsgerr->error < 0 && nlmsgerr->error != -EEXIST) {
- log_warning("Netlink failure for request %i: %s", response.header.nlmsg_seq, strerror(-nlmsgerr->error));
+ if (nlmsgerr->error < 0 && nlmsgerr->error != -EEXIST)
return nlmsgerr->error;
- }
return response.header.nlmsg_seq;
}
+static int check_loopback(void) {
+ int r, fd;
+ union {
+ struct sockaddr sa;
+ struct sockaddr_in in;
+ } sa;
+
+ /* If we failed to set up the loop back device, check whether
+ * it might already be set up */
+
+ fd = socket(AF_INET, SOCK_DGRAM|SOCK_NONBLOCK|SOCK_CLOEXEC, 0);
+ if (fd < 0)
+ return -errno;
+
+ zero(sa);
+ sa.in.sin_family = AF_INET;
+ sa.in.sin_addr.s_addr = INADDR_LOOPBACK;
+
+ if (bind(fd, &sa.sa, sizeof(sa.in)) >= 0)
+ r = 1;
+ else
+ r = errno == EADDRNOTAVAIL ? 0 : -errno;
+
+ close_nointr_nofail(fd);
+
+ return r;
+}
+
int loopback_setup(void) {
int r, if_loopback;
union {
struct sockaddr sa;
struct sockaddr_nl nl;
- struct sockaddr_storage storage;
} sa;
unsigned requests = 0, i;
int fd;
+ bool eperm = false;
errno = 0;
- if ((if_loopback = (int) if_nametoindex("lo")) <= 0)
+ if_loopback = (int) if_nametoindex("lo");
+ if (if_loopback <= 0)
return errno ? -errno : -ENODEV;
- if ((fd = socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE)) < 0)
+ fd = socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
+ if (fd < 0)
return -errno;
zero(sa);
sa.nl.nl_family = AF_NETLINK;
-
if (bind(fd, &sa.sa, sizeof(sa)) < 0) {
r = -errno;
goto finish;
}
- if ((r = add_adresses(fd, if_loopback, &requests)) < 0)
+ r = add_adresses(fd, if_loopback, &requests);
+ if (r < 0)
goto finish;
- if ((r = start_interface(fd, if_loopback, &requests)) < 0)
+ r = start_interface(fd, if_loopback, &requests);
+ if (r < 0)
goto finish;
for (i = 0; i < requests; i++) {
- if ((r = read_response(fd, requests)) < 0)
+ r = read_response(fd, requests);
+
+ if (r == -EPERM)
+ eperm = true;
+ else if (r < 0)
goto finish;
}
+ if (eperm && check_loopback() < 0) {
+ r = -EPERM;
+ goto finish;
+ }
+
r = 0;
finish:
commit a41b539efce4765c3e7a81ed308610776cc73173
Author: Lennart Poettering <lennart at poettering.net>
Date: Fri Apr 13 16:53:49 2012 +0200
manager: support systems lacking /dev/tty0
diff --git a/src/core/manager.c b/src/core/manager.c
index 2801500..869c99f 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -141,13 +141,17 @@ static int enable_special_signals(Manager *m) {
assert(m);
- /* Enable that we get SIGINT on control-alt-del */
- if (reboot(RB_DISABLE_CAD) < 0)
+ /* Enable that we get SIGINT on control-alt-del. In containers
+ * this will fail with EPERM, so ignore that. */
+ if (reboot(RB_DISABLE_CAD) < 0 && errno != EPERM)
log_warning("Failed to enable ctrl-alt-del handling: %m");
- if ((fd = open_terminal("/dev/tty0", O_RDWR|O_NOCTTY|O_CLOEXEC)) < 0)
- log_warning("Failed to open /dev/tty0: %m");
- else {
+ fd = open_terminal("/dev/tty0", O_RDWR|O_NOCTTY|O_CLOEXEC);
+ if (fd < 0) {
+ /* Support systems without virtual console */
+ if (fd != -ENOENT)
+ log_warning("Failed to open /dev/tty0: %m");
+ } else {
/* Enable that we get SIGWINCH on kbrequest */
if (ioctl(fd, KDSIGACCEPT, SIGWINCH) < 0)
log_warning("Failed to enable kbrequest handling: %s", strerror(errno));
commit e58a12770c0c7b9571cc80f487d666151811c1ee
Author: Lennart Poettering <lennart at poettering.net>
Date: Fri Apr 13 16:51:33 2012 +0200
nspawn: fake /dev/kmsg and /proc/kmsg as fifo
diff --git a/src/journal/journald.c b/src/journal/journald.c
index 97d2ec0..a6f27f6 100644
--- a/src/journal/journald.c
+++ b/src/journal/journald.c
@@ -2479,7 +2479,6 @@ static int open_proc_kmsg(Server *s) {
if (!s->import_proc_kmsg)
return 0;
-
s->proc_kmsg_fd = open("/proc/kmsg", O_RDONLY|O_CLOEXEC|O_NONBLOCK|O_NOCTTY);
if (s->proc_kmsg_fd < 0) {
log_warning("Failed to open /proc/kmsg, ignoring: %m");
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 685b4d4..9fc256e 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -213,32 +213,39 @@ static int mount_all(const char *dest) {
free(where);
}
- /* Fix the timezone, if possible */
- if (asprintf(&where, "%s/etc/localtime", dest) >= 0) {
+ return r;
+}
- if (mount("/etc/localtime", where, "bind", MS_BIND, NULL) >= 0)
- mount("/etc/localtime", where, "bind", MS_BIND|MS_REMOUNT|MS_RDONLY, NULL);
+static int setup_timezone(const char *dest) {
+ char *where;
- free(where);
+ assert(dest);
+
+ /* Fix the timezone, if possible */
+ if (asprintf(&where, "%s/etc/localtime", dest) < 0) {
+ log_error("Out of memory");
+ return -ENOMEM;
}
- if (asprintf(&where, "%s/etc/timezone", dest) >= 0) {
+ if (mount("/etc/localtime", where, "bind", MS_BIND, NULL) >= 0)
+ mount("/etc/localtime", where, "bind", MS_BIND|MS_REMOUNT|MS_RDONLY, NULL);
- if (mount("/etc/timezone", where, "bind", MS_BIND, NULL) >= 0)
- mount("/etc/timezone", where, "bind", MS_BIND|MS_REMOUNT|MS_RDONLY, NULL);
+ free(where);
- free(where);
+ if (asprintf(&where, "%s/etc/timezone", dest) < 0) {
+ log_error("Out of memory");
+ return -ENOMEM;
}
- if (asprintf(&where, "%s/proc/kmsg", dest) >= 0) {
- mount("/dev/null", where, "bind", MS_BIND, NULL);
- free(where);
- }
+ if (mount("/etc/timezone", where, "bind", MS_BIND, NULL) >= 0)
+ mount("/etc/timezone", where, "bind", MS_BIND|MS_REMOUNT|MS_RDONLY, NULL);
- return r;
+ free(where);
+
+ return 0;
}
-static int copy_devnodes(const char *dest, const char *console) {
+static int copy_devnodes(const char *dest) {
static const char devnodes[] =
"null\0"
@@ -248,22 +255,19 @@ static int copy_devnodes(const char *dest, const char *console) {
"urandom\0"
"tty\0"
"ptmx\0"
- "kmsg\0"
"rtc0\0";
const char *d;
- int r = 0, k;
+ int r = 0;
mode_t u;
- struct stat st;
- char *from = NULL, *to = NULL;
assert(dest);
- assert(console);
u = umask(0000);
NULSTR_FOREACH(d, devnodes) {
- from = to = NULL;
+ struct stat st;
+ char *from = NULL, *to = NULL;
asprintf(&from, "/dev/%s", d);
asprintf(&to, "%s/dev/%s", dest, d);
@@ -307,30 +311,43 @@ static int copy_devnodes(const char *dest, const char *console) {
free(to);
}
- if (stat(console, &st) < 0) {
+ umask(u);
- log_error("Failed to stat %s: %m", console);
- if (r == 0)
- r = -errno;
+ return r;
+}
+static int setup_dev_console(const char *dest, const char *console) {
+ struct stat st;
+ char *to = NULL;
+ int r;
+ mode_t u;
+
+ assert(dest);
+ assert(console);
+
+ u = umask(0000);
+
+ if (stat(console, &st) < 0) {
+ log_error("Failed to stat %s: %m", console);
+ r = -errno;
goto finish;
} else if (!S_ISCHR(st.st_mode)) {
-
log_error("/dev/console is not a char device.");
- if (r == 0)
- r = -EIO;
+ r = -EIO;
+ goto finish;
+ }
+ r = chmod_and_chown(console, 0600, 0, 0);
+ if (r < 0) {
+ log_error("Failed to correct access mode for TTY: %s", strerror(-r));
goto finish;
}
if (asprintf(&to, "%s/dev/console", dest) < 0) {
-
log_error("Out of memory");
- if (r == 0)
- r = -ENOMEM;
-
- goto finish;
+ r = -ENOMEM;
+ goto finish;
}
/* We need to bind mount the right tty to /dev/console since
@@ -340,26 +357,106 @@ static int copy_devnodes(const char *dest, const char *console) {
* doesn't actually matter here, since we mount it over
* anyway). */
- if (mknod(to, (st.st_mode & ~07777) | 0600, st.st_rdev) < 0)
- log_error("mknod for /dev/console failed: %m");
+ if (mknod(to, (st.st_mode & ~07777) | 0600, st.st_rdev) < 0) {
+ log_error("mknod() for /dev/console failed: %m");
+ r = -errno;
+ goto finish;
+ }
if (mount(console, to, "bind", MS_BIND, NULL) < 0) {
- log_error("bind mount for /dev/console failed: %m");
-
- if (r == 0)
- r = -errno;
+ log_error("Bind mount for /dev/console failed: %m");
+ r = -errno;
+ goto finish;
}
+finish:
free(to);
+ umask(u);
+
+ return r;
+}
+
+static int setup_kmsg(const char *dest, int kmsg_socket) {
+ char *from = NULL, *to = NULL;
+ int r, fd, k;
+ mode_t u;
+ union {
+ struct cmsghdr cmsghdr;
+ uint8_t buf[CMSG_SPACE(sizeof(int))];
+ } control;
+ struct msghdr mh;
+ struct cmsghdr *cmsg;
+
+ assert(dest);
+ assert(kmsg_socket >= 0);
- if ((k = chmod_and_chown(console, 0600, 0, 0)) < 0) {
- log_error("Failed to correct access mode for TTY: %s", strerror(-k));
+ u = umask(0000);
- if (r == 0)
- r = k;
+ if (asprintf(&from, "%s/dev/kmsg", dest) < 0) {
+ log_error("Out of memory");
+ r = -ENOMEM;
+ goto finish;
+ }
+
+ if (asprintf(&to, "%s/proc/kmsg", dest) < 0) {
+ log_error("Out of memory");
+ r = -ENOMEM;
+ goto finish;
+ }
+
+ if (mkfifo(from, 0600) < 0) {
+ log_error("mkfifo() for /dev/kmsg failed: %m");
+ r = -errno;
+ goto finish;
+ }
+
+ r = chmod_and_chown(from, 0600, 0, 0);
+ if (r < 0) {
+ log_error("Failed to correct access mode for /dev/kmsg: %s", strerror(-r));
+ goto finish;
+ }
+
+ if (mount(from, to, "bind", MS_BIND, NULL) < 0) {
+ log_error("Bind mount for /proc/kmsg failed: %m");
+ r = -errno;
+ goto finish;
+ }
+
+ fd = open(from, O_RDWR|O_NDELAY|O_CLOEXEC);
+ if (fd < 0) {
+ log_error("Failed to open fifo: %m");
+ r = -errno;
+ goto finish;
+ }
+
+ zero(mh);
+ zero(control);
+
+ mh.msg_control = &control;
+ mh.msg_controllen = sizeof(control);
+
+ cmsg = CMSG_FIRSTHDR(&mh);
+ cmsg->cmsg_level = SOL_SOCKET;
+ cmsg->cmsg_type = SCM_RIGHTS;
+ cmsg->cmsg_len = CMSG_LEN(sizeof(int));
+ memcpy(CMSG_DATA(cmsg), &fd, sizeof(int));
+
+ mh.msg_controllen = cmsg->cmsg_len;
+
+ /* Store away the fd in the socket, so that it stays open as
+ * long as we run the child */
+ k = sendmsg(kmsg_socket, &mh, MSG_DONTWAIT|MSG_NOSIGNAL);
+ close_nointr_nofail(fd);
+
+ if (k < 0) {
+ log_error("Failed to send FIFO fd: %m");
+ r = -errno;
+ goto finish;
}
finish:
+ free(from);
+ free(to);
umask(u);
return r;
@@ -639,6 +736,7 @@ int main(int argc, char *argv[]) {
sigset_t mask;
bool saved_attr_valid = false;
struct winsize ws;
+ int kmsg_socket_pair[2] = { -1, -1 };
log_parse_environment();
log_open();
@@ -740,6 +838,11 @@ int main(int argc, char *argv[]) {
goto finish;
}
+ if (socketpair(AF_UNIX, SOCK_DGRAM|SOCK_NONBLOCK|SOCK_CLOEXEC, 0, kmsg_socket_pair) < 0) {
+ log_error("Failed to create kmsg socket pair");
+ goto finish;
+ }
+
assert_se(sigemptyset(&mask) == 0);
sigset_add_many(&mask, SIGCHLD, SIGWINCH, SIGTERM, SIGINT, -1);
assert_se(sigprocmask(SIG_BLOCK, &mask, NULL) == 0);
@@ -779,7 +882,7 @@ int main(int argc, char *argv[]) {
close_nointr(STDOUT_FILENO);
close_nointr(STDERR_FILENO);
- close_all_fds(NULL, 0);
+ close_all_fds(&kmsg_socket_pair[1], 1);
reset_all_signal_handlers();
@@ -799,7 +902,18 @@ int main(int argc, char *argv[]) {
if (mount_all(arg_directory) < 0)
goto child_fail;
- if (copy_devnodes(arg_directory, console) < 0)
+ if (copy_devnodes(arg_directory) < 0)
+ goto child_fail;
+
+ if (setup_dev_console(arg_directory, console) < 0)
+ goto child_fail;
+
+ if (setup_kmsg(arg_directory, kmsg_socket_pair[1]) < 0)
+ goto child_fail;
+
+ close_nointr_nofail(kmsg_socket_pair[1]);
+
+ if (setup_timezone(arg_directory) < 0)
goto child_fail;
if (chdir(arg_directory) < 0) {
@@ -910,6 +1024,8 @@ finish:
if (master >= 0)
close_nointr_nofail(master);
+ close_pipe(kmsg_socket_pair);
+
if (oldcg)
cg_attach(SYSTEMD_CGROUP_CONTROLLER, oldcg, 0);
More information about the systemd-commits
mailing list