diff options
-rw-r--r-- | Changelog | 5 | ||||
-rw-r--r-- | Makefile | 11 | ||||
-rw-r--r-- | busybox.spec | 10 | ||||
-rw-r--r-- | examples/busybox.spec | 10 | ||||
-rw-r--r-- | kill.c | 49 | ||||
-rw-r--r-- | procps/kill.c | 49 |
6 files changed, 75 insertions, 59 deletions
@@ -2,6 +2,10 @@ * usage() now printf the BusyBox version. This will help folks realize that they are not in Kansas anymore. * Fixed mkdir -m option so that it works. + * kill segfaulted w/o any arguments. Now it doesn't do that. + * kill wasn't properly accepting signal names. It does now. + + -Erik Andersen 0.31 * I added a changelog for version 0.30. @@ -16,6 +20,7 @@ it wasn't supported before GNU libc 2.1, and some folks use glibc 2.0.7 since it is much smaller than that latest and greatest. + -Erik Andersen 0.30 Major changes -- lots of stuff rewritten. Many thanks to Lineo for @@ -22,7 +22,11 @@ BUILDTIME=$(shell date "+%Y%m%d-%H%M") # Comment out the following to make a debuggable build # Leave this off for production use. -#DODEBUG=true +DODEBUG=false +# If you want a static binary, turn this on. I can't think +# of many situations where anybody would ever want it static, +# but... +DOSTATIC=false #This will choke on a non-debian system ARCH=`uname -m | sed -e 's/i.86/i386/' | sed -e 's/sparc.*/sparc/'` @@ -37,6 +41,11 @@ else CFLAGS=-Wall -Os -fomit-frame-pointer -fno-builtin -D_GNU_SOURCE LDFLAGS= -s STRIP= strip --remove-section=.note --remove-section=.comment $(PROG) + #Only staticly link when _not_ debugging + ifeq ($(DOSTATIC),true) + LDFLAGS+= --static + endif + endif ifndef $(prefix) diff --git a/busybox.spec b/busybox.spec index 46bd7f484..281a381a7 100644 --- a/busybox.spec +++ b/busybox.spec @@ -11,11 +11,11 @@ Source: busybox-0.29a1.tar.gz %Description BusyBox is a suite of "tiny" Unix utilities in a multi-call binary. It -provides a pretty complete environment that fits on a floppy or in a -ROM. Just add "ash" (Keith Almquists tiny Bourne shell clone) and "ae", -and a kernel and you have a full system. This is used on the Debian -install disk and in an internet router, and it makes a good environment -for a "rescue" disk or any small or embedded system. +provides a pretty complete POSIX environment in a very small package. +Just add a kernel, "ash" (Keith Almquists tiny Bourne shell clone), and +an editor such as "elvis-tiny" or "ae", and you have a full system. This +is makes an excellent environment for a "rescue" disk or any small or +embedded system. %Prep %setup -q -n busybox diff --git a/examples/busybox.spec b/examples/busybox.spec index 46bd7f484..281a381a7 100644 --- a/examples/busybox.spec +++ b/examples/busybox.spec @@ -11,11 +11,11 @@ Source: busybox-0.29a1.tar.gz %Description BusyBox is a suite of "tiny" Unix utilities in a multi-call binary. It -provides a pretty complete environment that fits on a floppy or in a -ROM. Just add "ash" (Keith Almquists tiny Bourne shell clone) and "ae", -and a kernel and you have a full system. This is used on the Debian -install disk and in an internet router, and it makes a good environment -for a "rescue" disk or any small or embedded system. +provides a pretty complete POSIX environment in a very small package. +Just add a kernel, "ash" (Keith Almquists tiny Bourne shell clone), and +an editor such as "elvis-tiny" or "ae", and you have a full system. This +is makes an excellent environment for a "rescue" disk or any small or +embedded system. %Prep %setup -q -n busybox @@ -25,6 +25,7 @@ #include <stdlib.h> #include <unistd.h> #include <signal.h> +#include <ctype.h> const char kill_usage[] = "kill [-signal] process-id [process-id ...]\n"; @@ -112,47 +113,47 @@ const struct signal_name signames[] = { extern int kill_main (int argc, char **argv) { - int had_error = 0; int sig = SIGTERM; + if ( argc < 2 ) + usage (kill_usage); - - if (argv[1][0] == '-') { - if (argv[1][1] >= '0' && argv[1][1] <= '9') { - sig = atoi (&argv[1][1]); + if ( **(argv+1) == '-' ) { + if (isdigit( *(*(++argv)+1) )) { + sig = atoi (*argv); if (sig < 0 || sig >= NSIG) goto end; - } else { + } + else { const struct signal_name *s = signames; - for (;;) { - if (strcmp (s->name, &argv[1][1]) == 0) { + while (s->name != 0) { + if (strcasecmp (s->name, *argv+1) == 0) { sig = s->number; break; } s++; - if (s->name == 0) - goto end; } + if (s->name == 0) + goto end; } - argv++; - argc--; - } - while (argc > 1) { + + while (--argc > 1) { int pid; - if (argv[1][0] < '0' || argv[1][0] > '9') - goto end; - pid = atoi (argv[1]); + if (! isdigit( **(++argv))) { + fprintf(stderr, "bad PID: %s\n", *argv); + exit( FALSE); + } + pid = atoi (*argv); if (kill (pid, sig) != 0) { - had_error = 1; - perror (argv[1]); + perror (*argv); + exit ( FALSE); } - argv++; - argc--; } - if (had_error) { + end: - usage (kill_usage); - } + fprintf(stderr, "bad signal name: %s\n", *argv); exit (TRUE); } + + diff --git a/procps/kill.c b/procps/kill.c index 2fabf56d2..8cc2b044e 100644 --- a/procps/kill.c +++ b/procps/kill.c @@ -25,6 +25,7 @@ #include <stdlib.h> #include <unistd.h> #include <signal.h> +#include <ctype.h> const char kill_usage[] = "kill [-signal] process-id [process-id ...]\n"; @@ -112,47 +113,47 @@ const struct signal_name signames[] = { extern int kill_main (int argc, char **argv) { - int had_error = 0; int sig = SIGTERM; + if ( argc < 2 ) + usage (kill_usage); - - if (argv[1][0] == '-') { - if (argv[1][1] >= '0' && argv[1][1] <= '9') { - sig = atoi (&argv[1][1]); + if ( **(argv+1) == '-' ) { + if (isdigit( *(*(++argv)+1) )) { + sig = atoi (*argv); if (sig < 0 || sig >= NSIG) goto end; - } else { + } + else { const struct signal_name *s = signames; - for (;;) { - if (strcmp (s->name, &argv[1][1]) == 0) { + while (s->name != 0) { + if (strcasecmp (s->name, *argv+1) == 0) { sig = s->number; break; } s++; - if (s->name == 0) - goto end; } + if (s->name == 0) + goto end; } - argv++; - argc--; - } - while (argc > 1) { + + while (--argc > 1) { int pid; - if (argv[1][0] < '0' || argv[1][0] > '9') - goto end; - pid = atoi (argv[1]); + if (! isdigit( **(++argv))) { + fprintf(stderr, "bad PID: %s\n", *argv); + exit( FALSE); + } + pid = atoi (*argv); if (kill (pid, sig) != 0) { - had_error = 1; - perror (argv[1]); + perror (*argv); + exit ( FALSE); } - argv++; - argc--; } - if (had_error) { + end: - usage (kill_usage); - } + fprintf(stderr, "bad signal name: %s\n", *argv); exit (TRUE); } + + |