diff options
author | Eric Andersen <andersen@codepoet.org> | 1999-11-03 16:52:50 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 1999-11-03 16:52:50 +0000 |
commit | be971d6b693ca9cd1c9aa9eb6053aa2592c40547 (patch) | |
tree | 218f56d6ffdbb873e3d00d0ba3c48a17451d6668 | |
parent | 219d6f5e0cb4c8e1a9a5f554a8768c7afb12b0b4 (diff) | |
download | busybox-w32-be971d6b693ca9cd1c9aa9eb6053aa2592c40547.tar.gz busybox-w32-be971d6b693ca9cd1c9aa9eb6053aa2592c40547.tar.bz2 busybox-w32-be971d6b693ca9cd1c9aa9eb6053aa2592c40547.zip |
More init fixes. Fixed sync segfault.
-Erik
-rw-r--r-- | Changelog | 1 | ||||
-rw-r--r-- | archival/tar.c | 10 | ||||
-rw-r--r-- | busybox.spec | 2 | ||||
-rw-r--r-- | coreutils/sync.c | 4 | ||||
-rw-r--r-- | examples/busybox.spec | 2 | ||||
-rw-r--r-- | init.c | 30 | ||||
-rw-r--r-- | init/init.c | 30 | ||||
-rw-r--r-- | sync.c | 4 | ||||
-rw-r--r-- | tar.c | 10 |
9 files changed, 45 insertions, 48 deletions
@@ -8,6 +8,7 @@ | |||
8 | * Major adjustment of init.c. Code is now readable IMHO, | 8 | * Major adjustment of init.c. Code is now readable IMHO, |
9 | and much more solid. | 9 | and much more solid. |
10 | * Wrote sed -- weighs only 1.8k (5.8k with full regular expressions!). | 10 | * Wrote sed -- weighs only 1.8k (5.8k with full regular expressions!). |
11 | * Fixed a stupid seg-fault in sync | ||
11 | 12 | ||
12 | -Erik Andersen | 13 | -Erik Andersen |
13 | 14 | ||
diff --git a/archival/tar.c b/archival/tar.c index c7ef3851c..cd255f85c 100644 --- a/archival/tar.c +++ b/archival/tar.c | |||
@@ -37,8 +37,8 @@ | |||
37 | 37 | ||
38 | 38 | ||
39 | static const char tar_usage[] = | 39 | static const char tar_usage[] = |
40 | "Create, extract, or list files from a TAR file\n\n" | 40 | "tar -[cxtvOf] [tarFileName] [FILE] ...\n" |
41 | "usage: tar -[cxtvOf] [tarFileName] [FILE] ...\n" | 41 | "Create, extract, or list files from a tar file\n\n" |
42 | "\tc=create, x=extract, t=list contents, v=verbose,\n" | 42 | "\tc=create, x=extract, t=list contents, v=verbose,\n" |
43 | "\tO=extract to stdout, f=tarfile or \"-\" for stdin\n"; | 43 | "\tO=extract to stdout, f=tarfile or \"-\" for stdin\n"; |
44 | 44 | ||
@@ -151,10 +151,8 @@ extern int tar_main (int argc, char **argv) | |||
151 | argc--; | 151 | argc--; |
152 | argv++; | 152 | argv++; |
153 | 153 | ||
154 | if (argc < 1) { | 154 | if (argc < 1) |
155 | fprintf (stderr, "%s", tar_usage); | 155 | usage( tar_usage); |
156 | exit (FALSE); | ||
157 | } | ||
158 | 156 | ||
159 | 157 | ||
160 | errorFlag = FALSE; | 158 | errorFlag = FALSE; |
diff --git a/busybox.spec b/busybox.spec index f44cdc7a4..0cc15d435 100644 --- a/busybox.spec +++ b/busybox.spec | |||
@@ -30,7 +30,7 @@ h=`cat busybox.links` | |||
30 | 30 | ||
31 | for i in $h ; do | 31 | for i in $h ; do |
32 | mkdir -p $RPM_BUILD_ROOT/`echo $i | sed -e 's/\(^.*\/\)\(.*\)/\1/g' ` | 32 | mkdir -p $RPM_BUILD_ROOT/`echo $i | sed -e 's/\(^.*\/\)\(.*\)/\1/g' ` |
33 | (cd $RPM_BUILD_ROOT/bin ; ln -s ln `echo $i | sed -e 's/\(^.*\/\)\(.*\)/\2/g' ` ); | 33 | (cd $RPM_BUILD_ROOT/bin ; ln -s busybox `echo $i | sed -e 's/\(^.*\/\)\(.*\)/\2/g' ` ); |
34 | done | 34 | done |
35 | rm -f $RPM_BUILD_ROOT/bin/busybox | 35 | rm -f $RPM_BUILD_ROOT/bin/busybox |
36 | install -m 755 busybox $RPM_BUILD_ROOT/bin/busybox | 36 | install -m 755 busybox $RPM_BUILD_ROOT/bin/busybox |
diff --git a/coreutils/sync.c b/coreutils/sync.c index b9f52c8b0..cb4690c02 100644 --- a/coreutils/sync.c +++ b/coreutils/sync.c | |||
@@ -26,9 +26,9 @@ | |||
26 | extern int | 26 | extern int |
27 | sync_main(int argc, char * * argv) | 27 | sync_main(int argc, char * * argv) |
28 | { | 28 | { |
29 | if ( **(argv+1) == '-' ) { | 29 | if ( argc>1 && **(argv+1) == '-' ) { |
30 | usage( "sync\nWrite all buffered filesystem blocks to disk.\n"); | 30 | usage( "sync\nWrite all buffered filesystem blocks to disk.\n"); |
31 | } | 31 | } |
32 | return sync(); | 32 | exit( sync()); |
33 | } | 33 | } |
34 | 34 | ||
diff --git a/examples/busybox.spec b/examples/busybox.spec index f44cdc7a4..0cc15d435 100644 --- a/examples/busybox.spec +++ b/examples/busybox.spec | |||
@@ -30,7 +30,7 @@ h=`cat busybox.links` | |||
30 | 30 | ||
31 | for i in $h ; do | 31 | for i in $h ; do |
32 | mkdir -p $RPM_BUILD_ROOT/`echo $i | sed -e 's/\(^.*\/\)\(.*\)/\1/g' ` | 32 | mkdir -p $RPM_BUILD_ROOT/`echo $i | sed -e 's/\(^.*\/\)\(.*\)/\1/g' ` |
33 | (cd $RPM_BUILD_ROOT/bin ; ln -s ln `echo $i | sed -e 's/\(^.*\/\)\(.*\)/\2/g' ` ); | 33 | (cd $RPM_BUILD_ROOT/bin ; ln -s busybox `echo $i | sed -e 's/\(^.*\/\)\(.*\)/\2/g' ` ); |
34 | done | 34 | done |
35 | rm -f $RPM_BUILD_ROOT/bin/busybox | 35 | rm -f $RPM_BUILD_ROOT/bin/busybox |
36 | install -m 755 busybox $RPM_BUILD_ROOT/bin/busybox | 36 | install -m 755 busybox $RPM_BUILD_ROOT/bin/busybox |
@@ -45,18 +45,18 @@ | |||
45 | //#define DEBUG_INIT | 45 | //#define DEBUG_INIT |
46 | 46 | ||
47 | #define CONSOLE "/dev/console" /* Logical system console */ | 47 | #define CONSOLE "/dev/console" /* Logical system console */ |
48 | #define VT_PRIMARY "/dev/tty0" /* Primary virtual console */ | 48 | #define VT_PRIMARY "/dev/tty1" /* Primary virtual console */ |
49 | #define VT_SECONDARY "/dev/tty1" /* Virtual console */ | 49 | #define VT_SECONDARY "/dev/tty2" /* Virtual console */ |
50 | #define VT_LOG "/dev/tty2" /* Virtual console */ | 50 | #define VT_LOG "/dev/tty3" /* Virtual console */ |
51 | #define SERIAL_CON0 "/dev/ttyS0" /* Primary serial console */ | 51 | #define SERIAL_CON0 "/dev/ttyS0" /* Primary serial console */ |
52 | #define SERIAL_CON1 "/dev/ttyS1" /* Serial console */ | 52 | #define SERIAL_CON1 "/dev/ttyS1" /* Serial console */ |
53 | #define SHELL "/bin/sh" /* Default shell */ | 53 | #define SHELL "/bin/sh" /* Default shell */ |
54 | #define INITSCRIPT "/etc/init.d/rcS" /* Initscript. */ | 54 | #define INITSCRIPT "/etc/init.d/rcS" /* Initscript. */ |
55 | #define PATH_DEFAULT "PATH=/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin" | 55 | #define PATH_DEFAULT "PATH=/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin" |
56 | 56 | ||
57 | static char *console = VT_PRIMARY; | 57 | static char *console = CONSOLE; |
58 | static char *second_terminal = VT_SECONDARY; | 58 | static char *second_console = VT_SECONDARY; |
59 | static char *log = "/dev/tty3"; | 59 | static char *log = VT_LOG; |
60 | 60 | ||
61 | 61 | ||
62 | 62 | ||
@@ -173,23 +173,23 @@ static void console_init() | |||
173 | } | 173 | } |
174 | #endif | 174 | #endif |
175 | } else { | 175 | } else { |
176 | console = VT_PRIMARY; | 176 | console = CONSOLE; |
177 | tried_vtprimary++; | 177 | tried_devcons++; |
178 | } | 178 | } |
179 | 179 | ||
180 | while ((fd = open(console, O_RDONLY | O_NONBLOCK)) < 0) { | 180 | while ((fd = open(console, O_RDONLY | O_NONBLOCK)) < 0) { |
181 | /* Can't open selected console -- try vt1 */ | ||
182 | if (!tried_vtprimary) { | ||
183 | tried_vtprimary++; | ||
184 | console = VT_PRIMARY; | ||
185 | continue; | ||
186 | } | ||
187 | /* Can't open selected console -- try /dev/console */ | 181 | /* Can't open selected console -- try /dev/console */ |
188 | if (!tried_devcons) { | 182 | if (!tried_devcons) { |
189 | tried_devcons++; | 183 | tried_devcons++; |
190 | console = CONSOLE; | 184 | console = CONSOLE; |
191 | continue; | 185 | continue; |
192 | } | 186 | } |
187 | /* Can't open selected console -- try vt1 */ | ||
188 | if (!tried_vtprimary) { | ||
189 | tried_vtprimary++; | ||
190 | console = VT_PRIMARY; | ||
191 | continue; | ||
192 | } | ||
193 | break; | 193 | break; |
194 | } | 194 | } |
195 | if (fd < 0) | 195 | if (fd < 0) |
@@ -449,7 +449,7 @@ extern int init_main(int argc, char **argv) | |||
449 | pid1 = run(tty0_commands, console, wait_for_enter); | 449 | pid1 = run(tty0_commands, console, wait_for_enter); |
450 | } | 450 | } |
451 | if (pid2 == 0 && tty1_commands) { | 451 | if (pid2 == 0 && tty1_commands) { |
452 | pid2 = run(tty1_commands, second_terminal, TRUE); | 452 | pid2 = run(tty1_commands, second_console, TRUE); |
453 | } | 453 | } |
454 | wpid = wait(&status); | 454 | wpid = wait(&status); |
455 | if (wpid > 0 ) { | 455 | if (wpid > 0 ) { |
diff --git a/init/init.c b/init/init.c index 34eca8b77..899e43040 100644 --- a/init/init.c +++ b/init/init.c | |||
@@ -45,18 +45,18 @@ | |||
45 | //#define DEBUG_INIT | 45 | //#define DEBUG_INIT |
46 | 46 | ||
47 | #define CONSOLE "/dev/console" /* Logical system console */ | 47 | #define CONSOLE "/dev/console" /* Logical system console */ |
48 | #define VT_PRIMARY "/dev/tty0" /* Primary virtual console */ | 48 | #define VT_PRIMARY "/dev/tty1" /* Primary virtual console */ |
49 | #define VT_SECONDARY "/dev/tty1" /* Virtual console */ | 49 | #define VT_SECONDARY "/dev/tty2" /* Virtual console */ |
50 | #define VT_LOG "/dev/tty2" /* Virtual console */ | 50 | #define VT_LOG "/dev/tty3" /* Virtual console */ |
51 | #define SERIAL_CON0 "/dev/ttyS0" /* Primary serial console */ | 51 | #define SERIAL_CON0 "/dev/ttyS0" /* Primary serial console */ |
52 | #define SERIAL_CON1 "/dev/ttyS1" /* Serial console */ | 52 | #define SERIAL_CON1 "/dev/ttyS1" /* Serial console */ |
53 | #define SHELL "/bin/sh" /* Default shell */ | 53 | #define SHELL "/bin/sh" /* Default shell */ |
54 | #define INITSCRIPT "/etc/init.d/rcS" /* Initscript. */ | 54 | #define INITSCRIPT "/etc/init.d/rcS" /* Initscript. */ |
55 | #define PATH_DEFAULT "PATH=/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin" | 55 | #define PATH_DEFAULT "PATH=/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin" |
56 | 56 | ||
57 | static char *console = VT_PRIMARY; | 57 | static char *console = CONSOLE; |
58 | static char *second_terminal = VT_SECONDARY; | 58 | static char *second_console = VT_SECONDARY; |
59 | static char *log = "/dev/tty3"; | 59 | static char *log = VT_LOG; |
60 | 60 | ||
61 | 61 | ||
62 | 62 | ||
@@ -173,23 +173,23 @@ static void console_init() | |||
173 | } | 173 | } |
174 | #endif | 174 | #endif |
175 | } else { | 175 | } else { |
176 | console = VT_PRIMARY; | 176 | console = CONSOLE; |
177 | tried_vtprimary++; | 177 | tried_devcons++; |
178 | } | 178 | } |
179 | 179 | ||
180 | while ((fd = open(console, O_RDONLY | O_NONBLOCK)) < 0) { | 180 | while ((fd = open(console, O_RDONLY | O_NONBLOCK)) < 0) { |
181 | /* Can't open selected console -- try vt1 */ | ||
182 | if (!tried_vtprimary) { | ||
183 | tried_vtprimary++; | ||
184 | console = VT_PRIMARY; | ||
185 | continue; | ||
186 | } | ||
187 | /* Can't open selected console -- try /dev/console */ | 181 | /* Can't open selected console -- try /dev/console */ |
188 | if (!tried_devcons) { | 182 | if (!tried_devcons) { |
189 | tried_devcons++; | 183 | tried_devcons++; |
190 | console = CONSOLE; | 184 | console = CONSOLE; |
191 | continue; | 185 | continue; |
192 | } | 186 | } |
187 | /* Can't open selected console -- try vt1 */ | ||
188 | if (!tried_vtprimary) { | ||
189 | tried_vtprimary++; | ||
190 | console = VT_PRIMARY; | ||
191 | continue; | ||
192 | } | ||
193 | break; | 193 | break; |
194 | } | 194 | } |
195 | if (fd < 0) | 195 | if (fd < 0) |
@@ -449,7 +449,7 @@ extern int init_main(int argc, char **argv) | |||
449 | pid1 = run(tty0_commands, console, wait_for_enter); | 449 | pid1 = run(tty0_commands, console, wait_for_enter); |
450 | } | 450 | } |
451 | if (pid2 == 0 && tty1_commands) { | 451 | if (pid2 == 0 && tty1_commands) { |
452 | pid2 = run(tty1_commands, second_terminal, TRUE); | 452 | pid2 = run(tty1_commands, second_console, TRUE); |
453 | } | 453 | } |
454 | wpid = wait(&status); | 454 | wpid = wait(&status); |
455 | if (wpid > 0 ) { | 455 | if (wpid > 0 ) { |
@@ -26,9 +26,9 @@ | |||
26 | extern int | 26 | extern int |
27 | sync_main(int argc, char * * argv) | 27 | sync_main(int argc, char * * argv) |
28 | { | 28 | { |
29 | if ( **(argv+1) == '-' ) { | 29 | if ( argc>1 && **(argv+1) == '-' ) { |
30 | usage( "sync\nWrite all buffered filesystem blocks to disk.\n"); | 30 | usage( "sync\nWrite all buffered filesystem blocks to disk.\n"); |
31 | } | 31 | } |
32 | return sync(); | 32 | exit( sync()); |
33 | } | 33 | } |
34 | 34 | ||
@@ -37,8 +37,8 @@ | |||
37 | 37 | ||
38 | 38 | ||
39 | static const char tar_usage[] = | 39 | static const char tar_usage[] = |
40 | "Create, extract, or list files from a TAR file\n\n" | 40 | "tar -[cxtvOf] [tarFileName] [FILE] ...\n" |
41 | "usage: tar -[cxtvOf] [tarFileName] [FILE] ...\n" | 41 | "Create, extract, or list files from a tar file\n\n" |
42 | "\tc=create, x=extract, t=list contents, v=verbose,\n" | 42 | "\tc=create, x=extract, t=list contents, v=verbose,\n" |
43 | "\tO=extract to stdout, f=tarfile or \"-\" for stdin\n"; | 43 | "\tO=extract to stdout, f=tarfile or \"-\" for stdin\n"; |
44 | 44 | ||
@@ -151,10 +151,8 @@ extern int tar_main (int argc, char **argv) | |||
151 | argc--; | 151 | argc--; |
152 | argv++; | 152 | argv++; |
153 | 153 | ||
154 | if (argc < 1) { | 154 | if (argc < 1) |
155 | fprintf (stderr, "%s", tar_usage); | 155 | usage( tar_usage); |
156 | exit (FALSE); | ||
157 | } | ||
158 | 156 | ||
159 | 157 | ||
160 | errorFlag = FALSE; | 158 | errorFlag = FALSE; |