[BusyBox] CTRL-C does not work over serial terminal
Ilguiz Latypov
ilatypov at superbt.com
Mon Apr 8 18:35:04 UTC 2002
Matthias,
I somehow fixed the Ctrl-C behaviour. However, I don't know the root
cause. I attached the patch.
The patch also has some tinkering in the same init.c with regard to
corrupted serial transfer on Motorola Coldfire 5307 board. I noticed that
a pause between two consequitive string writes lets the last character of
the first string be sent cleanly. Restoring blocking access in
libbb/device_open.c alone did not help.
Another patch fixes dependency between .config and include/config.h in
Makefile. There seems to be another issue with busybox.links in
tests/Makefile.
Last, I corrected the parameter types in shell/msh.c with regard to
setjmp/longjmp. There are still warnings on declarations of variables
that are function pointers in shell/msh.c.
Ilguiz
On Mon, 8 Apr 2002, Matthias Fuchs wrote:
> after updating to the current CVS version of busybox, I noticed that
> CTRL-C is not working anymore over my serial console. It works fine,
> when I connect through telnet.
-------------- next part --------------
Index: Makefile
===================================================================
RCS file: /usr/local/cvsroot/busybox/Makefile,v
retrieving revision 1.1.1.2
retrieving revision 1.4
diff -u -r1.1.1.2 -r1.4
--- Makefile 25 Mar 2002 16:39:23 -0000 1.1.1.2
+++ Makefile 28 Mar 2002 03:02:50 -0000 1.4
@@ -17,6 +17,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
+.EXPORT_ALL_VARIABLES:
+
PROG := busybox
VERSION := 0.61.pre
BUILDTIME := $(shell TZ=UTC date -u "+%Y.%m.%d-%H:%M%z")
@@ -40,11 +42,11 @@
CFLAGS_EXTRA =
# If you want a static binary, turn this on.
-DOSTATIC = false
+DOSTATIC = true
# Set the following to `true' to make a debuggable build.
# Leave this set to `false' for production use.
-DODEBUG = false
+DODEBUG = true
# This enables compiling with dmalloc ( http://dmalloc.com/ )
# which is an excellent public domain mem leak and malloc problem
@@ -78,15 +80,15 @@
# If you are running a cross compiler, you may want to set CROSS
# to something more interesting, like "arm-linux-".
-CROSS =
-CC = $(CROSS)gcc
-AR = $(CROSS)ar
-AS = $(CROSS)as
-LD = $(CROSS)ld
-NM = $(CROSS)nm
-STRIP = $(CROSS)strip
-CPP = $(CC) -E
-MAKEFILES = $(TOPDIR)/.config
+# CROSS =
+# CC = $(CROSS)gcc
+# AR = $(CROSS)ar
+# AS = $(CROSS)as
+# LD = $(CROSS)ld
+# NM = $(CROSS)nm
+# STRIP = $(CROSS)strip
+# CPP = $(CC) -E
+# MAKEFILES = $(TOPDIR)/.config
export VERSION BUILDTIME TOPDIR HOSTCC HOSTCFLAGS CROSS CC AR AS LD NM STRIP CPP
@@ -110,6 +112,7 @@
#LDFLAGS+=-nostdlib
#LIBRARIES = $(LIBCDIR)/lib/libc.a -lgcc
#CROSS_CFLAGS+=-nostdinc -I$(LIBCDIR)/include -I$(GCCINCDIR)
+CROSS_CFLAGS := $(CFLAGS)
#GCCINCDIR = $(shell gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp")
# use '-Os' optimization if available, else use -O2
@@ -216,11 +219,11 @@
$(patsubst %, _dir_%, $(SUBDIRS)) : dummy include/config/MARKER
$(MAKE) CFLAGS="$(CFLAGS)" -C $(patsubst _dir_%, %, $@)
-busybox: config.h dep-files bbsubdirs
+busybox: include/config.h dep-files bbsubdirs
$(CC) $(LDFLAGS) -o $@ applets/busybox.o $(shell find $(SUBDIRS) -name \*.a) $(LIBRARIES)
$(STRIPCMD) $(PROG)
-busybox.links: applets/busybox.mkll
+busybox.links: applets/busybox.mkll include/config.h include/applets.h
- $(SHELL) $^ >$@
install: applets/install.sh busybox busybox.links
@@ -310,7 +313,7 @@
fi;
-depend dep: config.h dep-files
+depend dep: include/config.h dep-files
@ echo -e "\n\nNow run 'make' to build BusyBox\n\n"
BB_SHELL := ${shell if [ -x "$$BASH" ]; then echo $$BASH; \
@@ -321,10 +324,8 @@
scripts/split-include include/config.h include/config
@ touch include/config/MARKER
-config.h:
- @if [ ! -f include/config.h ] ; then \
- make oldconfig; \
- fi;
+include/config.h: .config
+ $(MAKE) oldconfig
menuconfig:
mkdir -p $(TOPDIR)/include/config
Index: init/init.c
===================================================================
RCS file: /usr/local/cvsroot/busybox/init/init.c,v
retrieving revision 1.1.1.1
retrieving revision 1.6
diff -u -r1.1.1.1 -r1.6
--- init/init.c 25 Mar 2002 16:39:24 -0000 1.1.1.1
+++ init/init.c 9 Apr 2002 00:10:57 -0000 1.6
@@ -164,7 +164,6 @@
static int kernelVersion = 0;
static char termType[32] = "TERM=linux";
static char console[32] = _PATH_CONSOLE;
-static sig_atomic_t got_cont = 0;
static const int LOG = 0x1;
static const int CONSOLE = 0x2;
#if defined CONFIG_FEATURE_EXTRA_QUIET
@@ -183,6 +182,7 @@
/* Function prototypes */
static void delete_init_action(struct init_action *a);
static int waitfor(struct init_action *a);
+static void set_term(int fd);
static void loop_forever(void)
@@ -194,10 +194,19 @@
/* Print a message to the specified device.
* Device may be bitwise-or'd from LOG | CONSOLE */
#ifdef DEBUG_INIT
-static inline messageND(int device, char *fmt, ...) { }
+
+#define messageND(arg...)
+#define messageD(options, fmt, args...) \
+ message(options, "%s: " ## fmt, __FUNCTION__ , ##args)
+
#else
+
#define messageND message
+#define messageD(arg...)
+
#endif
+
+
static void message(int device, char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
static void message(int device, char *fmt, ...)
{
@@ -226,7 +235,7 @@
log_fd = -2;
/* log to main console instead */
device = CONSOLE;
- } else if ((log_fd = device_open(log, O_RDWR|O_NDELAY)) < 0) {
+ } else if ((log_fd = device_open(log, O_RDWR)) < 0) {
log_fd = -2;
fprintf(stderr, "Bummer, can't write to log on %s!\n", log);
log = NULL;
@@ -241,13 +250,18 @@
#endif
if (device & CONSOLE) {
- /* Always send console messages to /dev/console so people will see them. */
+ /* Always send console messages to /dev/console
+ * so people will see them.
+ */
if (
(fd =
- device_open(_PATH_CONSOLE, O_WRONLY | O_NOCTTY | O_NDELAY)) >= 0) {
+ device_open(_PATH_CONSOLE, O_WRONLY | O_NOCTTY)) >= 0) {
va_start(arguments, fmt);
+ usleep(50000);
+ set_term(fd);
vdprintf(fd, fmt, arguments);
va_end(arguments);
+ usleep(50000);
close(fd);
} else {
fprintf(stderr, "Bummer, can't print: ");
@@ -263,6 +277,7 @@
{
struct termios tty;
+ memset(&tty, 0, sizeof(tty));
tcgetattr(fd, &tty);
/* set control chars */
@@ -280,7 +295,7 @@
/* Make it be sane */
tty.c_cflag &= CBAUD|CBAUDEX|CSIZE|CSTOPB|PARENB|PARODD;
- tty.c_cflag |= CREAD|HUPCL|CLOCAL;
+ tty.c_cflag |= CREAD|CLOCAL;
/* input modes */
@@ -291,9 +306,10 @@
/* local modes */
tty.c_lflag =
- ISIG | ICANON | ECHO | ECHOE | ECHOK | ECHOCTL | ECHOKE | IEXTEN;
+ ISIG | ICANON | ECHO | ECHOE | ECHOK | ECHOCTL | ECHOKE | IEXTEN
+ | NOFLSH;
- tcsetattr(fd, TCSANOW, &tty);
+ tcsetattr(fd, TCSADRAIN, &tty);
}
/* How much memory does this machine have?
@@ -360,7 +376,7 @@
}
}
- while ((fd = open(console, O_RDONLY | O_NONBLOCK)) < 0) {
+ while ((fd = open(console, O_RDONLY)) < 0) {
/* Can't open selected console -- try /dev/console */
if (!tried_devcons) {
tried_devcons++;
@@ -391,7 +407,7 @@
if (strcmp( termType, "TERM=linux" ) == 0)
safe_strncpy(termType, "TERM=vt102", sizeof(termType));
message(LOG | CONSOLE,
- "\rserial console detected. Disabling virtual terminals.\n");
+ "serial console detected. Disabling virtual terminals.\n");
}
close(fd);
}
@@ -418,12 +434,12 @@
* Calls "swapon -a" if needed so be sure /etc/fstab is present... */
static void check_memory(void)
{
- struct stat statBuf;
-
if (check_free_memory() > 1000)
return;
#if !defined(__UCLIBC__) || defined(__UCLIBC_HAS_MMU__)
+ struct stat statBuf;
+
if (stat("/etc/fstab", &statBuf) == 0) {
/* swapon -a requires /proc typically */
system("/bin/mount -t proc proc /proc");
@@ -434,11 +450,12 @@
} else
goto goodnight;
return;
-#endif
goodnight:
+#endif
+
message(CONSOLE,
- "\rSorry, your computer does not have enough memory.\n");
+ "Sorry, your computer does not have enough memory.\n");
loop_forever();
}
@@ -463,6 +480,9 @@
#endif
"\nPlease press Enter to activate this console. ";
+ messageD(LOG | CONSOLE, "Starting \"%s\" on \"%s\"\n",
+ a->command, a->terminal);
+
/* inherit environment to the child, merging our values -andy */
for (i=0; environ[i]; i++) {
for (j=0; environment[j]; j++) {
@@ -490,6 +510,20 @@
close(2);
sigprocmask(SIG_SETMASK, &omask, NULL);
+ /* Open the new terminal device */
+ if ((fd = device_open(a->terminal, O_RDWR|O_NOCTTY)) < 0) {
+ if (stat(a->terminal, &sb) != 0) {
+ message(LOG | CONSOLE, "device '%s' does not exist.\n",
+ a->terminal);
+ _exit(1);
+ }
+ message(LOG | CONSOLE, "Bummer, can't open %s\n", a->terminal);
+ _exit(1);
+ }
+
+ /* Make sure the terminal will act fairly normal for us */
+ set_term(fd);
+
/* Create a new session and make ourself the process group leader */
setsid();
@@ -503,19 +537,6 @@
signal(SIGSTOP, SIG_DFL);
signal(SIGTSTP, SIG_DFL);
- /* Open the new terminal device */
- if ((fd = device_open(a->terminal, O_RDWR|O_NOCTTY)) < 0) {
- if (stat(a->terminal, &sb) != 0) {
- message(LOG | CONSOLE, "\rdevice '%s' does not exist.\n",
- a->terminal);
- _exit(1);
- }
- message(LOG | CONSOLE, "\rBummer, can't open %s\n", a->terminal);
- _exit(1);
- }
- /* Make sure the terminal will act fairly normal for us */
- set_term(0);
-
/* If the init Action requires up to wait, then force the
* supplied terminal to be the controlling tty. */
if (a->action & (SYSINIT|WAIT|CTRLALTDEL|SHUTDOWN|RESTART)) {
@@ -524,8 +545,14 @@
ioctl(fd, TIOCSCTTY, 1);
/* Setup stdin, stdout, stderr for the new process so
* they point to the supplied terminal */
- dup(fd);
- dup(fd);
+ if (fd != 0)
+ dup2(fd, 0);
+ if (fd != 1)
+ dup2(fd, 1);
+ if (fd != 2)
+ dup2(fd, 2);
+ if (fd > 2)
+ close(fd);
/* Now fork off another process to just hang around */
if ((pid = fork()) < 0) {
@@ -554,7 +581,7 @@
/* Use a temporary process to steal the controlling tty. */
if ((pid = fork()) < 0) {
- message(LOG | CONSOLE, "\rCan't fork!\n");
+ message(LOG | CONSOLE, "Can't fork!\n");
_exit(1);
}
if (pid == 0) {
@@ -571,17 +598,23 @@
/* Now fall though to actually execute things */
} else {
- dup(fd);
- dup(fd);
+ if (fd != 0)
+ dup2(fd, 0);
+ if (fd != 1)
+ dup2(fd, 1);
+ if (fd != 2)
+ dup2(fd, 2);
+ if (fd > 2)
+ close(fd);
}
/* See if any special /bin/sh requiring characters are present */
if (strpbrk(a->command, "~`!$^&*()=|\\{}[];\"'<>?") != NULL) {
cmd[0] = SHELL;
cmd[1] = "-c";
- strcpy(buf, "exec ");
- safe_strncpy(buf + sizeof("exec "), a->command,
- sizeof(buf) - sizeof("exec "));
+ safe_strncpy(buf, "exec ", sizeof(buf));
+ safe_strncpy(buf + strlen("exec "), a->command,
+ sizeof(buf) - strlen("exec "));
cmd[2] = buf;
cmd[3] = NULL;
} else {
@@ -609,7 +642,6 @@
*/
if (*cmdpath == '-') {
-
/* skip over the dash */
++cmdpath;
@@ -622,8 +654,11 @@
cmd[0] = cmdpath;
} else {
cmd[0][0] = '-';
- strcpy(cmd[0]+1, s);
+ safe_strncpy(cmd[0]+1, s, strlen(s) + 1);
}
+
+ /* Take over the controlling tty */
+ ioctl(0, TIOCSCTTY, 1);
}
if (a->action & ASKFIRST) {
@@ -637,12 +672,12 @@
*/
messageND(LOG, "Waiting for enter to start '%s' (pid %d, terminal %s)\n",
cmdpath, getpid(), a->terminal);
- write(fileno(stdout), press_enter, sizeof(press_enter) - 1);
+ write(fileno(stdout), press_enter, strlen(press_enter));
getc(stdin);
}
/* Log the process name and args */
- messageND(LOG, "Starting pid %d, console %s: '%s'\n",
+ messageD(CONSOLE | LOG, "Starting pid %d, console %s: '%s'\n",
getpid(), a->terminal, cmdpath);
#if defined CONFIG_FEATURE_INIT_COREDUMPS
@@ -659,7 +694,7 @@
execve(cmdpath, cmd, environment);
/* We're still here? Some error happened. */
- message(LOG | CONSOLE, "\rBummer, could not run '%s': %s\n", cmdpath,
+ message(LOG | CONSOLE, "Bummer, could not run '%s': %s\n", cmdpath,
strerror(errno));
_exit(-1);
}
@@ -731,16 +766,16 @@
/* Allow Ctrl-Alt-Del to reboot system. */
init_reboot(RB_ENABLE_CAD);
- message(CONSOLE|LOG, "\n\rThe system is going down NOW !!\n");
+ message(CONSOLE|LOG, "\nThe system is going down NOW !!\n");
sync();
/* Send signals to every process _except_ pid 1 */
- message(CONSOLE|LOG, "\rSending SIGTERM to all processes.\n");
+ message(CONSOLE|LOG, "\nSending SIGTERM to all processes.\n");
kill(-1, SIGTERM);
sleep(1);
sync();
- message(CONSOLE|LOG, "\rSending SIGKILL to all processes.\n");
+ message(CONSOLE|LOG, "\nSending SIGKILL to all processes.\n");
kill(-1, SIGKILL);
sleep(1);
@@ -762,10 +797,10 @@
tmp = a->next;
if (a->action & RESTART) {
shutdown_system();
- message(CONSOLE|LOG, "\rTrying to re-exec %s\n", a->command);
+ message(CONSOLE|LOG, "Trying to re-exec %s\n", a->command);
execl(a->command, a->command, NULL);
- message(CONSOLE|LOG, "\rexec of '%s' failed: %s\n",
+ message(CONSOLE|LOG, "exec of '%s' failed: %s\n",
a->command, sys_errlist[errno]);
sync();
sleep(2);
@@ -781,10 +816,10 @@
message(CONSOLE|LOG,
#if #cpu(s390)
/* Seems the s390 console is Wierd(tm). */
- "\rThe system is halted. You may reboot now.\n"
+ "The system is halted. You may reboot now.\n"
#else
/* secondConsole is NULL for a serial console */
- "\rThe system is halted. Press %s or turn off power\n",
+ "\nThe system is halted. Press %s or turn off power\n",
(secondConsole == NULL)? "Reset" : "CTRL-ALT-DEL"
#endif
);
@@ -804,7 +839,7 @@
static void reboot_signal(int sig)
{
shutdown_system();
- message(CONSOLE|LOG, "\rPlease stand by while rebooting the system.\n");
+ message(CONSOLE|LOG, "\nPlease stand by while rebooting the system.\n");
sync();
/* allow time for last message to reach serial console */
@@ -820,6 +855,8 @@
run_actions(CTRLALTDEL);
}
+static sig_atomic_t got_cont = 0;
+
/* The SIGSTOP & SIGTSTP handler */
static void stop_handler(int sig)
{
@@ -843,6 +880,9 @@
{
struct init_action *new_action, *a;
+ messageD(LOG | CONSOLE, "action %d, command %s, cons %s\n",
+ action, command, cons);
+
if (*cons == '\0')
cons = console;
@@ -858,7 +898,7 @@
new_action = calloc((size_t) (1), sizeof(struct init_action));
if (!new_action) {
- message(LOG | CONSOLE, "\rMemory allocation failure\n");
+ message(LOG | CONSOLE, "Memory allocation failure\n");
loop_forever();
}
@@ -869,12 +909,12 @@
} else {
init_action_list = new_action;
}
- safe_strncpy(new_action->command, command, 255);
+ safe_strncpy(new_action->command, command, sizeof(new_action->command));
new_action->action = action;
- safe_strncpy(new_action->terminal, cons, 255);
+ safe_strncpy(new_action->terminal, cons, sizeof(new_action->terminal));
new_action->pid = 0;
-// message(LOG|CONSOLE, "command='%s' action='%d' terminal='%s'\n",
-// new_action->command, new_action->action, new_action->terminal);
+ messageD(LOG | CONSOLE, "command='%s' action='%d' terminal='%s'\n",
+ new_action->command, new_action->action, new_action->terminal);
}
static void delete_init_action(struct init_action * action)
@@ -958,12 +998,12 @@
*eol = '\0';
/* Keep a copy around for posterity's sake (and error msgs) */
- strcpy(lineAsRead, buf);
+ safe_strncpy(lineAsRead, buf, sizeof(lineAsRead));
/* Separate the ID field from the runlevels */
runlev = strchr(id, ':');
if (runlev == NULL || *(runlev + 1) == '\0') {
- message(LOG | CONSOLE, "\rBad inittab entry: %s\n", lineAsRead);
+ message(LOG | CONSOLE, "Bad inittab entry: %s\n", lineAsRead);
continue;
} else {
*runlev = '\0';
@@ -973,7 +1013,7 @@
/* Separate the runlevels from the action */
action = strchr(runlev, ':');
if (action == NULL || *(action + 1) == '\0') {
- message(LOG | CONSOLE, "\rBad inittab entry: %s\n", lineAsRead);
+ message(LOG | CONSOLE, "Bad inittab entry: %s\n", lineAsRead);
continue;
} else {
*action = '\0';
@@ -983,7 +1023,7 @@
/* Separate the action from the command */
command = strchr(action, ':');
if (command == NULL || *(command + 1) == '\0') {
- message(LOG | CONSOLE, "\rBad inittab entry: %s\n", lineAsRead);
+ message(LOG | CONSOLE, "Bad inittab entry: %s\n", lineAsRead);
continue;
} else {
*command = '\0';
@@ -995,8 +1035,9 @@
while (a->name != 0) {
if (strcmp(a->name, action) == 0) {
if (*id != '\0') {
- strcpy(tmpConsole, "/dev/");
- strncat(tmpConsole, id, 200);
+ safe_strncpy(tmpConsole, "/dev/", sizeof(tmpConsole));
+ safe_strncpy(tmpConsole + strlen("/dev/"), id,
+ sizeof(tmpConsole) - strlen("/dev/"));
id = tmpConsole;
}
new_init_action(a->action, command, id);
@@ -1008,7 +1049,7 @@
continue;
else {
/* Choke on an unknown action */
- message(LOG | CONSOLE, "\rBad inittab entry: %s\n", lineAsRead);
+ message(LOG | CONSOLE, "Bad inittab entry: %s\n", lineAsRead);
}
}
return;
@@ -1065,7 +1106,7 @@
kernelVersion = get_kernel_revision();
/* Close whatever files are open, and reset the console. */
- close(0);
+ // close(0);
close(1);
close(2);
@@ -1080,7 +1121,7 @@
putenv("PATH="_PATH_STDPATH);
/* Hello world */
- message(MAYBE_CONSOLE|LOG, "\rinit started: %s\n", full_version);
+ message(MAYBE_CONSOLE|LOG, "init started: %s\n", full_version);
/* Make sure there is enough memory to do something useful. */
check_memory();
@@ -1123,7 +1164,7 @@
/* If there is nothing else to do, stop */
if (init_action_list == NULL) {
- message(LOG | CONSOLE, "\rNo more tasks for init -- sleeping forever.\n");
+ message(LOG | CONSOLE, "No more tasks for init -- sleeping forever.\n");
loop_forever();
}
Index: libbb/device_open.c
===================================================================
RCS file: /usr/local/cvsroot/busybox/libbb/device_open.c,v
retrieving revision 1.1.1.2
retrieving revision 1.3
diff -u -r1.1.1.2 -r1.3
--- libbb/device_open.c 25 Mar 2002 16:39:24 -0000 1.1.1.2
+++ libbb/device_open.c 27 Mar 2002 00:15:47 -0000 1.3
@@ -29,7 +29,7 @@
{
int m, f, fd = -1;
- m = mode | O_NONBLOCK;
+ m = mode /* | O_NONBLOCK */;
/* Retry up to 5 times */
for (f = 0; f < 5; f++)
Index: shell/msh.c
===================================================================
RCS file: /usr/local/cvsroot/busybox/shell/msh.c,v
retrieving revision 1.1.1.1
retrieving revision 1.3
diff -u -r1.1.1.1 -r1.3
--- shell/msh.c 25 Mar 2002 16:39:25 -0000 1.1.1.1
+++ shell/msh.c 28 Mar 2002 03:06:49 -0000 1.3
@@ -66,7 +66,7 @@
/*
* library and system defintions
*/
-typedef void xint; /* base type of jmp_buf, for not broken compilers */
+typedef jmp_buf xint; /* base type of jmp_buf, for not broken compilers */
/*
* shell components
@@ -662,7 +662,7 @@
static struct env e ={line, iostack, iostack-1, (xint *)NULL, FDBASE, (struct env *)NULL};
static void (*qflag)(int) = SIG_IGN;
static char shellname[] = "/bin/sh";
-static char search[] = ":/bin:/usr/bin";
+static char search[] = "/usr/bin:/bin:/usr/sbin:/sbin";
static int startl;
static int peeksym;
static int nlseen;
@@ -900,8 +900,8 @@
inparse = 1;
intr = 0;
execflg = 0;
- setjmp(failpt = m1); /* Bruce Evans' fix */
- if (setjmp(failpt = m1) || yyparse() || intr) {
+ setjmp(*(failpt = &m1)); /* Bruce Evans' fix */
+ if (setjmp(*failpt) || yyparse() || intr) {
while (e.oenv)
quitenv();
scraphere();
@@ -930,7 +930,7 @@
static void
fail()
{
- longjmp(failpt, 1);
+ longjmp(*failpt, 1);
/* NOTREACHED */
}
@@ -969,7 +969,7 @@
if (!interactive)
leave();
if (e.errpt)
- longjmp(e.errpt, 1);
+ longjmp(*e.errpt, 1);
closeall();
e.iop = e.iobase = iostack;
}
@@ -2919,13 +2919,13 @@
otree = outtree;
ofail = failpt;
rv = -1;
- if (newenv(setjmp(errpt = ev)) == 0) {
+ if (newenv(setjmp(*(errpt = &ev))) == 0) {
wdlist = 0;
iolist = 0;
pushio(argp, f);
e.iobase = e.iop;
yynerrs = 0;
- if (setjmp(failpt = rt) == 0 && yyparse() == 0)
+ if (setjmp(*(failpt = &rt)) == 0 && yyparse() == 0)
rv = execute(outtree, NOPIPE, NOPIPE, 0);
quitenv();
}
@@ -3081,7 +3081,7 @@
return(1);
execflg = 1;
ofail = failpt;
- if (setjmp(failpt = ex) == 0)
+ if (setjmp(*(failpt = &ex)) == 0)
execute(t, NOPIPE, NOPIPE, FEXEC);
failpt = ofail;
execflg = 0;
@@ -3474,7 +3474,7 @@
wp = NULL;
wb = NULL;
wf = NULL;
- if (newenv(setjmp(errpt = ev)) == 0) {
+ if (newenv(setjmp(*(errpt = &ev))) == 0) {
while (*ap && isassign(*ap))
expand(*ap++, &wb, f & ~DOGLOB);
if (flag['k']) {
@@ -3553,7 +3553,7 @@
*wbp = addword(cp, *wbp);
return(1);
}
- if (newenv(setjmp(errpt = ev)) == 0) {
+ if (newenv(setjmp(*(errpt = &ev))) == 0) {
PUSHIO(aword, cp, strchar);
e.iobase = e.iop;
while ((cp = blank(f)) && gflg == 0) {
@@ -4714,7 +4714,7 @@
if (tf < 0)
return;
*name = strsave(tname, areanum);
- if (newenv(setjmp(errpt = ev)) != 0)
+ if (newenv(setjmp(*(errpt = &ev))) != 0)
unlink(tname);
else {
pushio(e.iop->argp, e.iop->iofn);
@@ -4780,7 +4780,7 @@
tf = mkstemp(tname);
if (tf < 0)
return (-1);
- if (newenv(setjmp(errpt = ev)) == 0) {
+ if (newenv(setjmp(*(errpt = &ev))) == 0) {
PUSHIO(afile, hf, herechar);
setbase(e.iop);
while ((c = subgetc(0, 0)) != 0) {
Index: tests/Makefile
===================================================================
RCS file: /usr/local/cvsroot/busybox/tests/Makefile,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- tests/Makefile 30 Aug 2001 05:56:50 -0000 1.1.1.1
+++ tests/Makefile 30 Aug 2001 06:34:49 -0000 1.2
@@ -18,16 +18,13 @@
include $(wildcard *_tests.mk)
-BBL := $(shell pushd .. >/dev/null && \
- ${MAKE} busybox.links >/dev/null && \
- popd >/dev/null && \
- cat ../busybox.links | \
- sed -e 's,.*/\(.*\)$$,\1,')
+BBL := $(shell test -f ../busybox.links && \
+ cat ../busybox.links | sed -e 's,.*/\(.*\)$$,\1,')
../busybox:
cd .. && ${MAKE} busybox
-${BBL}: ../busybox
+${BBL}: ../busybox ../busybox.links
rm -f $@
ln ../busybox $@
More information about the busybox
mailing list