Bug fixes.

-Erik
This commit is contained in:
Erik Andersen 2000-01-13 04:43:48 +00:00
parent 9a9a261569
commit 05df239ed9
19 changed files with 177 additions and 156 deletions

View File

@ -1,12 +1,17 @@
0.41 0.41
* New App: wc -- contributed by Edward Betts <edward@debian.org>
* Fixed a bug in both cp and mv preventing 'cp foo/README bar' * Fixed a bug in both cp and mv preventing 'cp foo/README bar'
type commands (file in a directory to another directory) type commands (file in a directory to another directory)
from working. from working.
* Fixed a logger bug that caused garbage to be written to the syslog * Fixed a logger bug that caused garbage to be written to the syslog
(unless you used busybox syslog, which hid the bug). Thanks (unless you used busybox syslog, which hid the bug). Thanks
to Alex Holden <alex@linuxhacker.org> for the fix. to Alex Holden <alex@linuxhacker.org> for the fix.
* /bin/true and /bin/false were echoing a blank line when run. Now fixed.
* mkdir -p would print an error when asked to mkdir an existing dir
with no interveining subdirectories.
* Fixed "syslogd -O" so that it works.
-Erik Andersen, -Erik Andersen
0.40 0.40
* New Apps: sort, uniq. -beppu * New Apps: sort, uniq. -beppu

View File

@ -17,7 +17,7 @@
PROG=busybox PROG=busybox
VERSION=0.40 VERSION=0.41
BUILDTIME=$(shell date "+%Y%m%d-%H%M") BUILDTIME=$(shell date "+%Y%m%d-%H%M")
# Comment out the following to make a debuggable build # Comment out the following to make a debuggable build

1
TODO
View File

@ -18,7 +18,6 @@ around to it some time. If you have any good ideas, please let me know.
* hwclock * hwclock
* killall * killall
* stty * stty
* wc
* tr * tr
* expr (maybe?) (ash builtin?) * expr (maybe?) (ash builtin?)

View File

@ -5,6 +5,16 @@
static int been_there_done_that = 0; static int been_there_done_that = 0;
#if 0
void exit (int status) __attribute__ ((noreturn));
void exit (int status) { _exit(status); };
void abort (void) __attribute__ ((__noreturn__));
void abort (void) { _exit(0); };
int atexit (void (*__func) (void)) { _exit(0); };
void *__libc_stack_end;
#endif
static const struct Applet applets[] = { static const struct Applet applets[] = {
#ifdef BB_BUSYBOX //bin #ifdef BB_BUSYBOX //bin
@ -219,6 +229,9 @@ static const struct Applet applets[] = {
{"true", true_main}, {"true", true_main},
{"false", false_main}, {"false", false_main},
#endif #endif
#ifdef BB_WC //usr/bin
{"wc", wc_main},
#endif
#ifdef BB_UNAME //bin #ifdef BB_UNAME //bin
{"uname", uname_main}, {"uname", uname_main},
#endif #endif
@ -241,6 +254,8 @@ static const struct Applet applets[] = {
{0} {0}
}; };
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
char *s = argv[0]; char *s = argv[0];

View File

@ -5,6 +5,16 @@
static int been_there_done_that = 0; static int been_there_done_that = 0;
#if 0
void exit (int status) __attribute__ ((noreturn));
void exit (int status) { _exit(status); };
void abort (void) __attribute__ ((__noreturn__));
void abort (void) { _exit(0); };
int atexit (void (*__func) (void)) { _exit(0); };
void *__libc_stack_end;
#endif
static const struct Applet applets[] = { static const struct Applet applets[] = {
#ifdef BB_BUSYBOX //bin #ifdef BB_BUSYBOX //bin
@ -219,6 +229,9 @@ static const struct Applet applets[] = {
{"true", true_main}, {"true", true_main},
{"false", false_main}, {"false", false_main},
#endif #endif
#ifdef BB_WC //usr/bin
{"wc", wc_main},
#endif
#ifdef BB_UNAME //bin #ifdef BB_UNAME //bin
{"uname", uname_main}, {"uname", uname_main},
#endif #endif
@ -241,6 +254,8 @@ static const struct Applet applets[] = {
{0} {0}
}; };
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
char *s = argv[0]; char *s = argv[0];

View File

@ -72,12 +72,13 @@
#define BB_SORT #define BB_SORT
#define BB_SWAPONOFF #define BB_SWAPONOFF
#define BB_SYNC #define BB_SYNC
//#define BB_SYSLOGD #define BB_SYSLOGD
#define BB_TAIL #define BB_TAIL
#define BB_TAR #define BB_TAR
#define BB_TEE #define BB_TEE
#define BB_TOUCH #define BB_TOUCH
#define BB_TRUE_FALSE #define BB_TRUE_FALSE
#define BB_WC
#define BB_UMOUNT #define BB_UMOUNT
#define BB_UNIQ #define BB_UNIQ
#define BB_UPDATE #define BB_UPDATE

View File

@ -1,5 +1,5 @@
Name: busybox Name: busybox
Version: 0.40 Version: 0.41
Release: 1 Release: 1
Group: System/Utilities Group: System/Utilities
Summary: BusyBox is a tiny suite of Unix utilities in a multi-call binary. Summary: BusyBox is a tiny suite of Unix utilities in a multi-call binary.
@ -21,7 +21,7 @@ embedded system.
%setup -q -n %{Name}-%{Version} %setup -q -n %{Name}-%{Version}
%Build %Build
BB_INIT_SCRIPT='\"/etc/rc.d/init.d/rcS\"' make make
%Install %Install
rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_ROOT

View File

@ -84,7 +84,7 @@ extern int mkdir_main(int argc, char **argv)
strcpy (buf, *argv); strcpy (buf, *argv);
status=stat(buf, &statBuf); status=stat(buf, &statBuf);
if (status != -1 && status != ENOENT ) { if (parentFlag == FALSE && status != -1 && status != ENOENT ) {
fprintf(stderr, "%s: File exists\n", buf); fprintf(stderr, "%s: File exists\n", buf);
exit( FALSE); exit( FALSE);
} }
@ -93,7 +93,7 @@ extern int mkdir_main(int argc, char **argv)
createPath(buf, mode); createPath(buf, mode);
} }
else { else {
if (mkdir (buf, mode) != 0) { if (mkdir (buf, mode) != 0 && parentFlag == FALSE) {
perror(buf); perror(buf);
exit( FALSE); exit( FALSE);
} }

View File

@ -12,6 +12,9 @@ ________________________________________________________________________________
BusyBox 0.38, Functions and the Arguments they Support BusyBox 0.38, Functions and the Arguments they Support
New Apps that have been added to BusyBox since this document was written:
ping, hostname, mkfifo, free, tail, du, tee, head, sort, uniq, lsmod, rmmod, fbset, and loadacm.
______________________________________________________________________________________________________ ______________________________________________________________________________________________________
@ -154,7 +157,7 @@ cp [option] fileA fileB
attributes group permissions and time information. attributes group permissions and time information.
-R recursive Copy to the current location and all subdirectories in the tree. -R recursive Copies directories recursively
@ -321,7 +324,7 @@ fsck.minix [-larvsmf] /dev/name
-r Perform interactive repairs. -r Perform interactive repairs.
-q Perform automatic repairs -a Perform automatic repairs
-v Verbose -v Verbose
@ -712,76 +715,32 @@ ________________________________________________________________________________
sed sed
Usage: sed [-n] -e script [file...]
Sed scripts are subject to the following format: 's/regexp/replacement/[gp]' which attempts to Allowed sed scripts come in the following form:
'ADDR [!] COMMAND'
to match regexp against the pattern space and if successful, replaces the matched portion with where address ADDR can be:
NUMBER Match specified line number
$ Match last line
/REGEXP/ Match specified regexp
(! inverts the meaning of the match)
replacement -r or -R Remove contents of directories recursively. and COMMAND can be:
s/regexp/replacement/[igp]
which attempt to match regexp against the pattern space
and if successful replaces the matched portion with replacement.
aTEXT
which appends TEXT after the pattern space
Options:
-e add the script to the commands to be executed
-n suppress automatic printing of pattern space
This version of sed matches full regular expresions.
________________________________________________________________________________________________________
rmdir [OPTION] ... directory
Remove directories if they are empty.
________________________________________________________________________________________________________
rmdir [OPTION] ... directory
Remove directories if they are empty.
________________________________________________________________________________________________________
sed
Sed scripts are subject to the following format: 's/regexp/replacement/[gp]' which attempts to
match regexp against the pattern space and if successful, replaces the matched portion with
replacement. This version of sed matches
full regular expressions.
-e Add the script to the commands to be executed.
-n Suppress automatic printing of pattern space..
-e Add the script to the commands to be executed.
-n Suppress automatic printing of pattern space..
-e Add the script to the commands to be executed.
-n Suppress automatic printing of pattern space.
________________________________________________________________________________________________________ ________________________________________________________________________________________________________
@ -977,9 +936,25 @@ ________________________________________________________________________________
zcat [options] files zcat [options] files
Uncompress file from gzip, gunzip or compress command or standard input if file is '-'. Usage: zcat [OPTION]... FILE
-c Write output to standard output. Uncompress FILE (or standard input if FILE is '-').
(When invoked as zcat, defaults to having -c turned on)
Options:
-c Write output to standard output
-t Test compressed file integrity
________________________________________________________________________________________________________
gunzip (Same as zcat, but without the "-c" option.)
@ -991,22 +966,13 @@ ________________________________________________________________________________
gunzip (Same as zcat) gzip [OPTION]... FILE
________________________________________________________________________________________________________
gzip (Same as zcat)
Compress FILE with maximum compression.
When FILE is -, reads standard input. Implies -c.
Options:
-c Write output to standard output instead of FILE.gz

View File

@ -1,5 +1,5 @@
Name: busybox Name: busybox
Version: 0.40 Version: 0.41
Release: 1 Release: 1
Group: System/Utilities Group: System/Utilities
Summary: BusyBox is a tiny suite of Unix utilities in a multi-call binary. Summary: BusyBox is a tiny suite of Unix utilities in a multi-call binary.
@ -21,7 +21,7 @@ embedded system.
%setup -q -n %{Name}-%{Version} %setup -q -n %{Name}-%{Version}
%Build %Build
BB_INIT_SCRIPT='\"/etc/rc.d/init.d/rcS\"' make make
%Install %Install
rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_ROOT

44
init.c
View File

@ -331,7 +331,7 @@ static void console_init()
static pid_t run(char* command, static pid_t run(char* command,
char *terminal, int get_enter) char *terminal, int get_enter)
{ {
int i; int i, fd;
pid_t pid; pid_t pid;
char* tmpCmd; char* tmpCmd;
char* cmd[255]; char* cmd[255];
@ -357,21 +357,20 @@ static pid_t run(char* command,
close(2); close(2);
setsid(); setsid();
if (device_open(terminal, O_RDWR) < 0) {
message(LOG|CONSOLE, "Bummer, can't open %s\r\n", terminal);
exit(1);
}
dup(0);
dup(0);
tcsetpgrp (0, getpgrp());
set_term(0);
/* Reset signal handlers set for parent process */ /* Reset signal handlers set for parent process */
signal(SIGUSR1, SIG_DFL); signal(SIGUSR1, SIG_DFL);
signal(SIGUSR2, SIG_DFL); signal(SIGUSR2, SIG_DFL);
signal(SIGINT, SIG_DFL); signal(SIGINT, SIG_DFL);
signal(SIGTERM, SIG_DFL); signal(SIGTERM, SIG_DFL);
if ((fd = device_open(terminal, O_RDWR)) < 0) {
message(LOG|CONSOLE, "Bummer, can't open %s\r\n", terminal);
exit(1);
}
dup(fd);
dup(fd);
tcsetpgrp (0, getpgrp());
set_term(0);
if (get_enter==TRUE) { if (get_enter==TRUE) {
/* /*
@ -389,19 +388,21 @@ static pid_t run(char* command,
read(fileno(stdin), &c, 1); read(fileno(stdin), &c, 1);
} }
/* Log the process name and args */
message(LOG|CONSOLE, "Starting pid %d, console %s: '",
shell_pgid, terminal, command);
/* Convert command (char*) into cmd (char**, one word per string) */ /* Convert command (char*) into cmd (char**, one word per string) */
for (tmpCmd=command, i=0; (tmpCmd=strsep(&command, " \t")) != NULL;) { for (tmpCmd=command, i=0; (tmpCmd=strsep(&command, " \t")) != NULL;) {
if (*tmpCmd != '\0') { if (*tmpCmd != '\0') {
cmd[i] = tmpCmd; cmd[i] = tmpCmd;
message(LOG|CONSOLE, "%s ", tmpCmd);
tmpCmd++; tmpCmd++;
i++; i++;
} }
} }
cmd[i] = NULL; cmd[i] = NULL;
message(LOG|CONSOLE, "'\r\n");
/* Log the process name and args */
message(LOG, "Starting pid %d, console %s: '%s'\r\n",
shell_pgid, terminal, cmd[0]);
/* Now run it. The new program will take over this PID, /* Now run it. The new program will take over this PID,
* so nothing further in init.c should be run. */ * so nothing further in init.c should be run. */
@ -540,8 +541,8 @@ void new_initAction (initActionEnum action,
} else } else
strncpy(newAction->console, console, 255); strncpy(newAction->console, console, 255);
newAction->pid = 0; newAction->pid = 0;
// message(LOG|CONSOLE, "process='%s' action='%d' console='%s'\n", message(LOG|CONSOLE, "process='%s' action='%d' console='%s'\n",
// newAction->process, newAction->action, newAction->console); newAction->process, newAction->action, newAction->console);
} }
void delete_initAction (initAction *action) void delete_initAction (initAction *action)
@ -672,11 +673,8 @@ extern int init_main(int argc, char **argv)
usage( "init\n\nInit is the parent of all processes.\n\n" usage( "init\n\nInit is the parent of all processes.\n\n"
"This version of init is designed to be run only by the kernel\n"); "This version of init is designed to be run only by the kernel\n");
} }
/* Set up sig handlers -- be sure to
/* from the controlling terminal */ * clear all of these in run() */
setsid();
/* Set up sig handlers -- be sure to clear all of these in run() */
signal(SIGUSR1, halt_signal); signal(SIGUSR1, halt_signal);
signal(SIGUSR2, reboot_signal); signal(SIGUSR2, reboot_signal);
signal(SIGINT, reboot_signal); signal(SIGINT, reboot_signal);
@ -686,7 +684,7 @@ extern int init_main(int argc, char **argv)
* SIGINT on CAD so we can shut things down gracefully... */ * SIGINT on CAD so we can shut things down gracefully... */
reboot(RB_DISABLE_CAD); reboot(RB_DISABLE_CAD);
#endif #endif
/* Figure out where the default console should be */ /* Figure out where the default console should be */
console_init(); console_init();
@ -695,11 +693,11 @@ extern int init_main(int argc, char **argv)
close(1); close(1);
close(2); close(2);
set_term(0); set_term(0);
setsid();
/* Make sure PATH is set to something sane */ /* Make sure PATH is set to something sane */
putenv(_PATH_STDPATH); putenv(_PATH_STDPATH);
/* Hello world */ /* Hello world */
#ifndef DEBUG_INIT #ifndef DEBUG_INIT
message(LOG|CONSOLE, message(LOG|CONSOLE,

View File

@ -331,7 +331,7 @@ static void console_init()
static pid_t run(char* command, static pid_t run(char* command,
char *terminal, int get_enter) char *terminal, int get_enter)
{ {
int i; int i, fd;
pid_t pid; pid_t pid;
char* tmpCmd; char* tmpCmd;
char* cmd[255]; char* cmd[255];
@ -357,21 +357,20 @@ static pid_t run(char* command,
close(2); close(2);
setsid(); setsid();
if (device_open(terminal, O_RDWR) < 0) {
message(LOG|CONSOLE, "Bummer, can't open %s\r\n", terminal);
exit(1);
}
dup(0);
dup(0);
tcsetpgrp (0, getpgrp());
set_term(0);
/* Reset signal handlers set for parent process */ /* Reset signal handlers set for parent process */
signal(SIGUSR1, SIG_DFL); signal(SIGUSR1, SIG_DFL);
signal(SIGUSR2, SIG_DFL); signal(SIGUSR2, SIG_DFL);
signal(SIGINT, SIG_DFL); signal(SIGINT, SIG_DFL);
signal(SIGTERM, SIG_DFL); signal(SIGTERM, SIG_DFL);
if ((fd = device_open(terminal, O_RDWR)) < 0) {
message(LOG|CONSOLE, "Bummer, can't open %s\r\n", terminal);
exit(1);
}
dup(fd);
dup(fd);
tcsetpgrp (0, getpgrp());
set_term(0);
if (get_enter==TRUE) { if (get_enter==TRUE) {
/* /*
@ -389,19 +388,21 @@ static pid_t run(char* command,
read(fileno(stdin), &c, 1); read(fileno(stdin), &c, 1);
} }
/* Log the process name and args */
message(LOG|CONSOLE, "Starting pid %d, console %s: '",
shell_pgid, terminal, command);
/* Convert command (char*) into cmd (char**, one word per string) */ /* Convert command (char*) into cmd (char**, one word per string) */
for (tmpCmd=command, i=0; (tmpCmd=strsep(&command, " \t")) != NULL;) { for (tmpCmd=command, i=0; (tmpCmd=strsep(&command, " \t")) != NULL;) {
if (*tmpCmd != '\0') { if (*tmpCmd != '\0') {
cmd[i] = tmpCmd; cmd[i] = tmpCmd;
message(LOG|CONSOLE, "%s ", tmpCmd);
tmpCmd++; tmpCmd++;
i++; i++;
} }
} }
cmd[i] = NULL; cmd[i] = NULL;
message(LOG|CONSOLE, "'\r\n");
/* Log the process name and args */
message(LOG, "Starting pid %d, console %s: '%s'\r\n",
shell_pgid, terminal, cmd[0]);
/* Now run it. The new program will take over this PID, /* Now run it. The new program will take over this PID,
* so nothing further in init.c should be run. */ * so nothing further in init.c should be run. */
@ -540,8 +541,8 @@ void new_initAction (initActionEnum action,
} else } else
strncpy(newAction->console, console, 255); strncpy(newAction->console, console, 255);
newAction->pid = 0; newAction->pid = 0;
// message(LOG|CONSOLE, "process='%s' action='%d' console='%s'\n", message(LOG|CONSOLE, "process='%s' action='%d' console='%s'\n",
// newAction->process, newAction->action, newAction->console); newAction->process, newAction->action, newAction->console);
} }
void delete_initAction (initAction *action) void delete_initAction (initAction *action)
@ -672,11 +673,8 @@ extern int init_main(int argc, char **argv)
usage( "init\n\nInit is the parent of all processes.\n\n" usage( "init\n\nInit is the parent of all processes.\n\n"
"This version of init is designed to be run only by the kernel\n"); "This version of init is designed to be run only by the kernel\n");
} }
/* Set up sig handlers -- be sure to
/* from the controlling terminal */ * clear all of these in run() */
setsid();
/* Set up sig handlers -- be sure to clear all of these in run() */
signal(SIGUSR1, halt_signal); signal(SIGUSR1, halt_signal);
signal(SIGUSR2, reboot_signal); signal(SIGUSR2, reboot_signal);
signal(SIGINT, reboot_signal); signal(SIGINT, reboot_signal);
@ -686,7 +684,7 @@ extern int init_main(int argc, char **argv)
* SIGINT on CAD so we can shut things down gracefully... */ * SIGINT on CAD so we can shut things down gracefully... */
reboot(RB_DISABLE_CAD); reboot(RB_DISABLE_CAD);
#endif #endif
/* Figure out where the default console should be */ /* Figure out where the default console should be */
console_init(); console_init();
@ -695,11 +693,11 @@ extern int init_main(int argc, char **argv)
close(1); close(1);
close(2); close(2);
set_term(0); set_term(0);
setsid();
/* Make sure PATH is set to something sane */ /* Make sure PATH is set to something sane */
putenv(_PATH_STDPATH); putenv(_PATH_STDPATH);
/* Hello world */ /* Hello world */
#ifndef DEBUG_INIT #ifndef DEBUG_INIT
message(LOG|CONSOLE, message(LOG|CONSOLE,

View File

@ -125,6 +125,7 @@ extern int touch_main(int argc, char** argv);
extern int tput_main(int argc, char** argv); extern int tput_main(int argc, char** argv);
extern int true_main(int argc, char** argv); extern int true_main(int argc, char** argv);
extern int tryopen_main(int argc, char** argv); extern int tryopen_main(int argc, char** argv);
extern int wc_main(int argc, char** argv);
extern int umount_main(int argc, char** argv); extern int umount_main(int argc, char** argv);
extern int uniq_main(int argc, char** argv); extern int uniq_main(int argc, char** argv);
extern int update_main(int argc, char** argv); extern int update_main(int argc, char** argv);

View File

@ -84,7 +84,7 @@ extern int mkdir_main(int argc, char **argv)
strcpy (buf, *argv); strcpy (buf, *argv);
status=stat(buf, &statBuf); status=stat(buf, &statBuf);
if (status != -1 && status != ENOENT ) { if (parentFlag == FALSE && status != -1 && status != ENOENT ) {
fprintf(stderr, "%s: File exists\n", buf); fprintf(stderr, "%s: File exists\n", buf);
exit( FALSE); exit( FALSE);
} }
@ -93,7 +93,7 @@ extern int mkdir_main(int argc, char **argv)
createPath(buf, mode); createPath(buf, mode);
} }
else { else {
if (mkdir (buf, mode) != 0) { if (mkdir (buf, mode) != 0 && parentFlag == FALSE) {
perror(buf); perror(buf);
exit( FALSE); exit( FALSE);
} }

View File

@ -9,7 +9,7 @@ if ! eval diff -u tar.c testdir ; then
echo "Bummer. File copy failed." echo "Bummer. File copy failed."
exit 0 exit 0
else else
echo "Cool. File copy is ok." echo "Cool. 'cp tar.c testdir' is ok."
fi fi
rm -rf testdir rm -rf testdir
@ -20,7 +20,7 @@ if ! eval diff -u tar.c testdir/foo/tar.c ; then
echo "Bummer. File copy to a directory failed." echo "Bummer. File copy to a directory failed."
exit 0 exit 0
else else
echo "Cool. File copy to a directory is ok." echo "Cool. 'cp tar.c testdir/foo' is ok."
fi fi
@ -32,7 +32,7 @@ if ! eval diff -u tar.c testdir/foo/tar.c ; then
echo "Bummer. File copy to a directory w/ a '/' failed." echo "Bummer. File copy to a directory w/ a '/' failed."
exit 0 exit 0
else else
echo "Cool. File copy to a directory w/ a '/' is ok." echo "Cool. 'cp tar.c testdir/foo/' is ok."
fi fi
@ -44,7 +44,7 @@ if ! eval diff -ur X11 testdir ; then
echo "Bummer. Local dir copy failed." echo "Bummer. Local dir copy failed."
exit 0 exit 0
else else
echo "Cool. Local dir copy is ok." echo "Cool. 'cp -a X11 testdir' is ok."
fi fi
rm -rf testdir X11 rm -rf testdir X11
@ -55,7 +55,7 @@ if ! eval diff -ur X11 testdir ; then
echo "Bummer. Local dir copy w/ a '/' failed." echo "Bummer. Local dir copy w/ a '/' failed."
exit 0 exit 0
else else
echo "Cool. Local dir copy w/ a '/' is ok." echo "Cool. 'cp -a X11 testdir/' is ok."
fi fi
rm -rf testdir X11 rm -rf testdir X11
@ -66,7 +66,7 @@ if ! eval diff -ur X11 testdir ; then
echo "Bummer. Local dir copy w/ a src '/' failed." echo "Bummer. Local dir copy w/ a src '/' failed."
exit 0 exit 0
else else
echo "Cool. Local dir copy w/ a src '/' is ok." echo "Cool. 'cp -a X11/ testdir' is ok."
fi fi
rm -rf testdir X11 rm -rf testdir X11
@ -77,7 +77,7 @@ if ! eval diff -ur X11 testdir ; then
echo "Bummer. Local dir copy w/ 2x '/'s failed." echo "Bummer. Local dir copy w/ 2x '/'s failed."
exit 0 exit 0
else else
echo "Cool. Local dir copy w/ 2x '/'s is ok." echo "Cool. 'cp -a X11/ testdir/' is ok."
fi fi
rm -rf testdir X11 rm -rf testdir X11
@ -86,7 +86,7 @@ if ! eval diff -ur /etc/X11 testdir ; then
echo "Bummer. Remote dir copy failed." echo "Bummer. Remote dir copy failed."
exit 0 exit 0
else else
echo "Cool. Remote dir copy is ok." echo "Cool. 'cp -a /etc/X11 testdir' is ok."
fi fi
@ -98,7 +98,7 @@ if ! eval diff -ur /etc/X11 testdir/foo ; then
echo "Bummer. Remote dir copy to a directory failed." echo "Bummer. Remote dir copy to a directory failed."
exit 0 exit 0
else else
echo "Cool. Remote dir copy to a directory is ok." echo "Cool. 'cp -a /etc/X11 testdir/foo' is ok."
fi fi
@ -110,7 +110,7 @@ if ! eval diff -ur /etc/X11 testdir/foo ; then
echo "Bummer. Remote dir copy to a directory w/ a '/' failed." echo "Bummer. Remote dir copy to a directory w/ a '/' failed."
exit 0 exit 0
else else
echo "Cool. Remote dir copy to a directory w/ a '/' is ok." echo "Cool. 'cp -a /etc/X11 testdir/foo/' is ok."
fi fi
rm -rf testdir rm -rf testdir
@ -124,14 +124,24 @@ if ! eval ./busybox cp README foo ; then
echo "Bummer. cp README foo failed." echo "Bummer. cp README foo failed."
exit 0 exit 0
else else
echo "Cool. cp README foo is ok." echo "Cool. 'cp README foo' is ok."
fi fi
if ! eval ./busybox cp foo/README bar ; then if ! eval ./busybox cp foo/README bar ; then
echo "Bummer. cp foo/README bar failed." echo "Bummer. cp foo/README bar failed."
exit 0 exit 0
else else
echo "Cool. cp foo/README bar is ok." echo "Cool. 'cp foo/README bar' is ok."
fi
rm -f bar/README
ENVVAR1=foo
ENVVAR2=bar
if ! eval ./busybox cp $ENVVAR1/README $ENVVAR2 ; then
echo "Bummer. cp foo/README bar failed."
exit 0
else
echo "Cool. 'cp \$ENVVAR1/README \$ENVVAR2' is ok."
fi fi
rm -rf foo bar rm -rf foo bar

View File

@ -337,11 +337,13 @@ extern int syslogd_main(int argc, char **argv)
#ifdef BB_KLOGD #ifdef BB_KLOGD
int startKlogd = TRUE; int startKlogd = TRUE;
#endif #endif
int stopDoingThat = FALSE;
char *p; char *p;
char **argv1=argv; char **argv1=argv;
while (--argc > 0 && **(++argv1) == '-') { while (--argc > 0 && **(++argv1) == '-') {
while (*(++(*argv1))) { stopDoingThat = FALSE;
while (stopDoingThat == FALSE && *(++(*argv1))) {
switch (**argv1) { switch (**argv1) {
case 'm': case 'm':
if (--argc == 0) { if (--argc == 0) {
@ -362,6 +364,7 @@ extern int syslogd_main(int argc, char **argv)
usage(syslogd_usage); usage(syslogd_usage);
} }
logFilePath = *(++argv1); logFilePath = *(++argv1);
stopDoingThat = TRUE;
break; break;
default: default:
usage(syslogd_usage); usage(syslogd_usage);

View File

@ -337,11 +337,13 @@ extern int syslogd_main(int argc, char **argv)
#ifdef BB_KLOGD #ifdef BB_KLOGD
int startKlogd = TRUE; int startKlogd = TRUE;
#endif #endif
int stopDoingThat = FALSE;
char *p; char *p;
char **argv1=argv; char **argv1=argv;
while (--argc > 0 && **(++argv1) == '-') { while (--argc > 0 && **(++argv1) == '-') {
while (*(++(*argv1))) { stopDoingThat = FALSE;
while (stopDoingThat == FALSE && *(++(*argv1))) {
switch (**argv1) { switch (**argv1) {
case 'm': case 'm':
if (--argc == 0) { if (--argc == 0) {
@ -362,6 +364,7 @@ extern int syslogd_main(int argc, char **argv)
usage(syslogd_usage); usage(syslogd_usage);
} }
logFilePath = *(++argv1); logFilePath = *(++argv1);
stopDoingThat = TRUE;
break; break;
default: default:
usage(syslogd_usage); usage(syslogd_usage);

View File

@ -27,12 +27,12 @@
extern int extern int
true_main(int argc, char** argv) true_main(int argc, char** argv)
{ {
return( TRUE); exit( TRUE);
} }
extern int extern int
false_main(int argc, char** argv) false_main(int argc, char** argv)
{ {
return( FALSE); exit( FALSE);
} }

View File

@ -396,7 +396,7 @@ recursiveAction(const char *fileName, int recurse, int followLinks, int depthFir
int (*dirAction) (const char *fileName, struct stat* statbuf)) int (*dirAction) (const char *fileName, struct stat* statbuf))
{ {
int status; int status;
struct stat statbuf; struct stat statbuf, statbuf1;
struct dirent *next; struct dirent *next;
if (followLinks == TRUE) if (followLinks == TRUE)
@ -404,6 +404,7 @@ recursiveAction(const char *fileName, int recurse, int followLinks, int depthFir
else else
status = lstat(fileName, &statbuf); status = lstat(fileName, &statbuf);
status = lstat(fileName, &statbuf);
if (status < 0) { if (status < 0) {
perror(fileName); perror(fileName);
return (FALSE); return (FALSE);
@ -424,8 +425,14 @@ recursiveAction(const char *fileName, int recurse, int followLinks, int depthFir
return (TRUE); return (TRUE);
} }
} }
status = lstat(fileName, &statbuf1);
if (status < 0) {
perror(fileName);
return (FALSE);
}
if (S_ISDIR(statbuf.st_mode)) { if (S_ISDIR(statbuf.st_mode) && S_ISDIR(statbuf1.st_mode)) {
DIR *dir; DIR *dir;
dir = opendir(fileName); dir = opendir(fileName);
if (!dir) { if (!dir) {