chiark / gitweb /
main: log to the console in a container
authorLennart Poettering <lennart@poettering.net>
Mon, 14 Mar 2011 03:48:14 +0000 (04:48 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 14 Mar 2011 14:37:02 +0000 (15:37 +0100)
src/main.c
src/nspawn.c

index 313afcce166d2f7bc0d82130930751c980cf7a78..0c805c98a9f89fe010fe837a47ef72f33412af00 100644 (file)
@@ -1021,7 +1021,7 @@ int main(int argc, char *argv[]) {
 
         if (getpid() == 1) {
                 arg_running_as = MANAGER_SYSTEM;
 
         if (getpid() == 1) {
                 arg_running_as = MANAGER_SYSTEM;
-                log_set_target(LOG_TARGET_SYSLOG_OR_KMSG);
+                log_set_target(detect_container(NULL) > 0 ? LOG_TARGET_CONSOLE : LOG_TARGET_SYSLOG_OR_KMSG);
 
                 /* This might actually not return, but cause a
                  * reexecution */
 
                 /* This might actually not return, but cause a
                  * reexecution */
index 297bb61f63b480f5d01f888e38159152f82d4900..f340805f38339835d8162d291dfd33a73961ef9d 100644 (file)
@@ -254,7 +254,7 @@ static int copy_devnodes(const char *dest) {
                                         r = -errno;
                         }
 
                                         r = -errno;
                         }
 
-                        if (mount(from, to, "bind", MS_BIND, NULL) < 0) {
+                        if (mount(from, to, "bind", MS_BIND|MS_RDONLY, NULL) < 0) {
                                 log_error("bind mount for /dev/console failed: %m");
 
                                 if (r == 0)
                                 log_error("bind mount for /dev/console failed: %m");
 
                                 if (r == 0)