diff options
-rw-r--r-- | Changelog | 12 | ||||
-rw-r--r-- | archival/tar.c | 1 | ||||
-rw-r--r-- | busybox.def.h | 6 | ||||
-rw-r--r-- | coreutils/dd.c | 2 | ||||
-rw-r--r-- | dd.c | 2 | ||||
-rw-r--r-- | init.c | 30 | ||||
-rw-r--r-- | init/init.c | 30 | ||||
-rw-r--r-- | mnc.c | 14 | ||||
-rw-r--r-- | regexp.c | 2 | ||||
-rw-r--r-- | tar.c | 1 | ||||
-rw-r--r-- | umount.c | 2 | ||||
-rw-r--r-- | util-linux/umount.c | 2 | ||||
-rw-r--r-- | utility.c | 6 |
13 files changed, 65 insertions, 45 deletions
@@ -1,3 +1,15 @@ +0.36 + * fixed dd so it properly defaults to stdin and stdout when no + if= and of= are set (fix thanks to Eric Delaunay). + * Don't try to close the file descriptor of a pipe. (fix also from + Eric Delaunay). + * Made createPath be quiet (again thanks to Eric Delaunay). + * If BB_CONSOLE_CMD_IF_RC_SCRIPT_EXITS is defined, then whatever + command you define it as will be run if the init script exits. + * Made createPath be quiet (again thanks to Eric Delaunay). + + -Erik Andersen + 0.35 * gzip now obeys the principle of least surprise and acts like god intended (i.e. it accepts a file name, answers --help, and obeys the '-c' flag diff --git a/archival/tar.c b/archival/tar.c index 5478af86e..1fdbf8c1c 100644 --- a/archival/tar.c +++ b/archival/tar.c @@ -559,6 +559,7 @@ readHeader (const TarHeader * hp, int fileCount, char **fileTable) outFd = mknod (name, mode, makedev(major, minor) ); } else if (S_ISFIFO(mode) ) { + devFileFlag = TRUE; outFd = mkfifo(name, mode); } else { outFd = open (name, O_WRONLY | O_CREAT | O_TRUNC, mode); diff --git a/busybox.def.h b/busybox.def.h index 5896861de..6e2b818d6 100644 --- a/busybox.def.h +++ b/busybox.def.h @@ -17,7 +17,7 @@ //#define BB_FDFLUSH #define BB_FIND #define BB_FSCK_MINIX -//#define BB_MKFS_MINIX +#define BB_MKFS_MINIX #define BB_CHVT #define BB_DEALLOCVT #define BB_GREP @@ -34,7 +34,7 @@ #define BB_MKDIR #define BB_MKNOD #define BB_MKSWAP -//#define BB_MNC +#define BB_MNC #define BB_MORE #define BB_MOUNT //#define BB_MT @@ -54,7 +54,7 @@ #define BB_SYNC #define BB_TAR #define BB_TOUCH -//#define BB_TRUE_FALSE // Supplied by ash +#define BB_TRUE_FALSE #define BB_UMOUNT #define BB_UPDATE #define BB_UNAME diff --git a/coreutils/dd.c b/coreutils/dd.c index 800ed59f8..9468cddfc 100644 --- a/coreutils/dd.c +++ b/coreutils/dd.c @@ -152,8 +152,6 @@ extern int dd_main (int argc, char **argv) argc--; argv++; } - if ( inFile == NULL || outFile == NULL) - goto usage; buf = malloc (blockSize); if (buf == NULL) { @@ -152,8 +152,6 @@ extern int dd_main (int argc, char **argv) argc--; argv++; } - if ( inFile == NULL || outFile == NULL) - goto usage; buf = malloc (blockSize); if (buf == NULL) { @@ -417,10 +417,14 @@ extern int init_main(int argc, char **argv) pid_t pid1 = 0; pid_t pid2 = 0; struct stat statbuf; - const char* const init_commands[] = { INITSCRIPT, INITSCRIPT, 0}; - const char* const shell_commands[] = { SHELL, "-" SHELL, 0}; - const char* const* tty0_commands = shell_commands; - const char* const* tty1_commands = shell_commands; + const char* const rc_script_command[] = { INITSCRIPT, INITSCRIPT, 0}; + const char* const shell_command[] = { SHELL, "-" SHELL, 0}; + const char* const* tty0_command = shell_command; + const char* const* tty1_command = shell_command; +#ifdef BB_CONSOLE_CMD_IF_RC_SCRIPT_EXITS + const char* const rc_exit_command[] = BB_CONSOLE_CMD_IF_RC_SCRIPT_EXITS; +#endif + #ifdef DEBUG_INIT char *hello_msg_format = "init(%d) started: BusyBox v%s (%s) multi-call binary\r\n"; @@ -493,7 +497,7 @@ extern int init_main(int argc, char **argv) /* Make sure an init script exists before trying to run it */ if (run_rc == TRUE && stat(INITSCRIPT, &statbuf)==0) { wait_for_enter = FALSE; - tty0_commands = init_commands; + tty0_command = rc_script_command; } @@ -504,11 +508,11 @@ extern int init_main(int argc, char **argv) pid_t wpid; int status; - if (pid1 == 0 && tty0_commands) { - pid1 = run(tty0_commands, console, wait_for_enter); + if (pid1 == 0 && tty0_command) { + pid1 = run(tty0_command, console, wait_for_enter); } - if (pid2 == 0 && tty1_commands && second_console) { - pid2 = run(tty1_commands, second_console, TRUE); + if (pid2 == 0 && tty1_command && second_console) { + pid2 = run(tty1_command, second_console, TRUE); } wpid = wait(&status); if (wpid > 0 ) { @@ -518,13 +522,13 @@ extern int init_main(int argc, char **argv) if (wpid == pid1) { if (run_rc == FALSE) { pid1 = 0; - } -#if 0 -/* Turn this on to start a shell on the console if the init script exits.... */ + } +#ifdef BB_CONSOLE_CMD_IF_RC_SCRIPT_EXITS else { + pid1 = 0; run_rc=FALSE; wait_for_enter=TRUE; - tty0_commands=shell_commands; + tty0_command=rc_exit_command; } #endif } diff --git a/init/init.c b/init/init.c index e70d5a15d..a3e8d6700 100644 --- a/init/init.c +++ b/init/init.c @@ -417,10 +417,14 @@ extern int init_main(int argc, char **argv) pid_t pid1 = 0; pid_t pid2 = 0; struct stat statbuf; - const char* const init_commands[] = { INITSCRIPT, INITSCRIPT, 0}; - const char* const shell_commands[] = { SHELL, "-" SHELL, 0}; - const char* const* tty0_commands = shell_commands; - const char* const* tty1_commands = shell_commands; + const char* const rc_script_command[] = { INITSCRIPT, INITSCRIPT, 0}; + const char* const shell_command[] = { SHELL, "-" SHELL, 0}; + const char* const* tty0_command = shell_command; + const char* const* tty1_command = shell_command; +#ifdef BB_CONSOLE_CMD_IF_RC_SCRIPT_EXITS + const char* const rc_exit_command[] = BB_CONSOLE_CMD_IF_RC_SCRIPT_EXITS; +#endif + #ifdef DEBUG_INIT char *hello_msg_format = "init(%d) started: BusyBox v%s (%s) multi-call binary\r\n"; @@ -493,7 +497,7 @@ extern int init_main(int argc, char **argv) /* Make sure an init script exists before trying to run it */ if (run_rc == TRUE && stat(INITSCRIPT, &statbuf)==0) { wait_for_enter = FALSE; - tty0_commands = init_commands; + tty0_command = rc_script_command; } @@ -504,11 +508,11 @@ extern int init_main(int argc, char **argv) pid_t wpid; int status; - if (pid1 == 0 && tty0_commands) { - pid1 = run(tty0_commands, console, wait_for_enter); + if (pid1 == 0 && tty0_command) { + pid1 = run(tty0_command, console, wait_for_enter); } - if (pid2 == 0 && tty1_commands && second_console) { - pid2 = run(tty1_commands, second_console, TRUE); + if (pid2 == 0 && tty1_command && second_console) { + pid2 = run(tty1_command, second_console, TRUE); } wpid = wait(&status); if (wpid > 0 ) { @@ -518,13 +522,13 @@ extern int init_main(int argc, char **argv) if (wpid == pid1) { if (run_rc == FALSE) { pid1 = 0; - } -#if 0 -/* Turn this on to start a shell on the console if the init script exits.... */ + } +#ifdef BB_CONSOLE_CMD_IF_RC_SCRIPT_EXITS else { + pid1 = 0; run_rc=FALSE; wait_for_enter=TRUE; - tty0_commands=shell_commands; + tty0_command=rc_exit_command; } #endif } @@ -40,8 +40,8 @@ #define BUFSIZE 100 static const char mnc_usage[] = -"mini-netcat 0.0.3 -- Open pipe to IP:port\n" -"\tmnc [IP] [port]\n"; +"mnc [IP] [port]\n\n" +"mini-netcat opens a pipe to IP:port\n"; int mnc_main(int argc, char **argv) @@ -56,9 +56,15 @@ mnc_main(int argc, char **argv) fd_set readfds, testfds; + if (argc<=1 || **(argv+1) == '-' ) { + usage( mnc_usage); + } + argc--; + argv++; + sfd = socket(AF_INET, SOCK_STREAM, 0); - hostinfo = (struct hostent *) gethostbyname(argv[1]); + hostinfo = (struct hostent *) gethostbyname(*argv); if (!hostinfo) { @@ -67,7 +73,7 @@ mnc_main(int argc, char **argv) address.sin_family = AF_INET; address.sin_addr = *(struct in_addr *) *hostinfo->h_addr_list; - address.sin_port = htons(atoi(argv[2])); + address.sin_port = htons(atoi(*(++argv))); len = sizeof(address); @@ -135,7 +135,7 @@ static char *retext; /* points to the text being compiled */ /* error-handling stuff */ jmp_buf errorhandler; -#define FAIL(why) fprintf(stderr, why); longjmp(errorhandler, 1) +#define FAIL(why) do {fprintf(stderr, why); longjmp(errorhandler, 1);} while (0) @@ -559,6 +559,7 @@ readHeader (const TarHeader * hp, int fileCount, char **fileTable) outFd = mknod (name, mode, makedev(major, minor) ); } else if (S_ISFIFO(mode) ) { + devFileFlag = TRUE; outFd = mkfifo(name, mode); } else { outFd = open (name, O_WRONLY | O_CREAT | O_TRUNC, mode); @@ -124,7 +124,7 @@ umount_main(int argc, char** argv) } - if(umountAll) { + if(umountAll==TRUE) { exit(umount_all(useMtab)); } if ( do_umount(*argv,useMtab) == 0 ) diff --git a/util-linux/umount.c b/util-linux/umount.c index 0d105d9c1..061bb9b16 100644 --- a/util-linux/umount.c +++ b/util-linux/umount.c @@ -124,7 +124,7 @@ umount_main(int argc, char** argv) } - if(umountAll) { + if(umountAll==TRUE) { exit(umount_all(useMtab)); } if ( do_umount(*argv,useMtab) == 0 ) @@ -488,12 +488,8 @@ extern void createPath (const char *name, int mode) while (cp) { cpOld = cp; cp = strchr (cp + 1, '/'); - *cpOld = '\0'; - - if (mkdir (buf, cp ? 0777 : mode) == 0) - printf ("Directory \"%s\" created\n", buf); - + mkdir (buf, cp ? 0777 : mode); *cpOld = '/'; } } |