From 18a2fbda564ed7fd184d648a68250e6050995b3f Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Mon, 3 Jan 2005 13:54:27 +0000 Subject: ensure /tmp/syslog in stage2 contains the full log (currently stage2 init was writing in a file shadowed by stage2 copying the /stage1/tmp/syslog over its file) --- mdk-stage1/init.c | 2 +- mdk-stage1/stage1.c | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'mdk-stage1') diff --git a/mdk-stage1/init.c b/mdk-stage1/init.c index 622e38ff6..81252a0ea 100644 --- a/mdk-stage1/init.c +++ b/mdk-stage1/init.c @@ -126,7 +126,7 @@ void doklog() } mkdir("/tmp", 0755); - if ((log = open("/tmp/syslog", O_WRONLY | O_CREAT, 0644)) < 0) { + if ((log = open("/tmp/syslog", O_WRONLY | O_CREAT | O_APPEND, 0644)) < 0) { print_error("error opening /tmp/syslog"); sleep(5); return; diff --git a/mdk-stage1/stage1.c b/mdk-stage1/stage1.c index eb832db38..836b13d2d 100644 --- a/mdk-stage1/stage1.c +++ b/mdk-stage1/stage1.c @@ -560,7 +560,11 @@ void finish_preparing(void) stg1_fatal_message("Fatal error finishing initialization."); } #endif - + + /* /tmp/syslog is used by the second init, so it must be copied now, not in stage2 */ + /* we remove it to ensure the old one is not copied over it in stage2 */ + copy_file("/tmp/syslog", SLASH_LOCATION "/tmp/syslog", NULL); + unlink("/tmp/syslog"); copy_file("/etc/resolv.conf", SLASH_LOCATION "/etc/resolv.conf", NULL); mkdir(SLASH_LOCATION "/modules", 0755); copy_file("/modules/modules.dep", SLASH_LOCATION "/modules/modules.dep", NULL); -- cgit v1.2.1