diff options
author | Olivier Blin <oblin@mandriva.org> | 2004-06-11 14:42:40 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.org> | 2004-06-11 14:42:40 +0000 |
commit | 9a4ddbc85674f341854696ea2d55af038d23df8d (patch) | |
tree | c95b65d8d30a6823bc387059adb88290774ed488 /mdk-stage1 | |
parent | 99a03f82cc8c7deffcfc0cac4587872c44b104e7 (diff) | |
download | drakx-backup-do-not-use-9a4ddbc85674f341854696ea2d55af038d23df8d.tar drakx-backup-do-not-use-9a4ddbc85674f341854696ea2d55af038d23df8d.tar.gz drakx-backup-do-not-use-9a4ddbc85674f341854696ea2d55af038d23df8d.tar.bz2 drakx-backup-do-not-use-9a4ddbc85674f341854696ea2d55af038d23df8d.tar.xz drakx-backup-do-not-use-9a4ddbc85674f341854696ea2d55af038d23df8d.zip |
in testing mode, try to open cmdline file in current directory before trying in /proc
Diffstat (limited to 'mdk-stage1')
-rw-r--r-- | mdk-stage1/tools.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/mdk-stage1/tools.c b/mdk-stage1/tools.c index 76a70dec0..2a5200aa7 100644 --- a/mdk-stage1/tools.c +++ b/mdk-stage1/tools.c @@ -53,13 +53,23 @@ static int param_number = 0; void process_cmdline(void) { char buf[512]; - int fd, size, i; - - log_message("opening /proc/cmdline... "); - - if ((fd = open("/proc/cmdline", O_RDONLY)) == -1) - fatal_error("could not open /proc/cmdline"); - + int size, i; + int fd = -1; + + if (IS_TESTING) { + log_message("TESTING: opening cmdline... "); + + if ((fd = open("cmdline", O_RDONLY)) == -1) + log_message("TESTING: could not open cmdline"); + } + + if (fd == -1) { + log_message("opening /proc/cmdline... "); + + if ((fd = open("/proc/cmdline", O_RDONLY)) == -1) + fatal_error("could not open /proc/cmdline"); + } + size = read(fd, buf, sizeof(buf)); buf[size-1] = '\0'; // -1 to eat the \n close(fd); |