aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Andersen <andersen@codepoet.org>2000-05-20 00:40:08 +0000
committerErik Andersen <andersen@codepoet.org>2000-05-20 00:40:08 +0000
commit8ea7d8cdaf4a03cdc06abc8b752b589271140a88 (patch)
tree955fc9545f490ca39f0c24629316b7d328612802
parent330fd2b5767110f29544131d4c72c77e0506b6df (diff)
downloadbusybox-8ea7d8cdaf4a03cdc06abc8b752b589271140a88.tar.gz
First pass at fixing tar segfault, and more portability updates.
-Erik
-rw-r--r--TODO5
-rw-r--r--archival/tar.c5
-rw-r--r--cmdedit.c6
-rw-r--r--fsck_minix.c1
-rw-r--r--internal.h12
-rw-r--r--mkfs_minix.c5
-rw-r--r--shell/cmdedit.c6
-rw-r--r--tar.c5
-rw-r--r--util-linux/fsck_minix.c1
-rw-r--r--util-linux/mkfs_minix.c5
10 files changed, 27 insertions, 24 deletions
diff --git a/TODO b/TODO
index 7ab43c36d..febd9bf51 100644
--- a/TODO
+++ b/TODO
@@ -22,6 +22,11 @@ Bugs that need fixing:
- 'grep *foo file' segfaults
- ps dirent race bug (need to stat the file before attempting chdir)
+
+/busybox tar tvf
+Segmentation fault (core dumped)
+
+
-----------
* Make insmod actually work
diff --git a/archival/tar.c b/archival/tar.c
index 6784d80ff..c5aad45d6 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -185,7 +185,7 @@ extern int tar_main(int argc, char **argv)
usage(tar_usage);
/* Parse any options */
- while (--argc > 0 && **(++argv) == '-') {
+ while (--argc > 0 && strspn(*(++argv), "-cxt") >0 ) {
stopIt=FALSE;
while (stopIt==FALSE && *(++(*argv))) {
switch (**argv) {
@@ -265,7 +265,8 @@ extern int tar_main(int argc, char **argv)
#else
exit(writeTarFile(tarName, tostdoutFlag, verboseFlag, argc, argv, excludeList));
#endif
- } else {
+ }
+ if (listFlag == TRUE || extractFlag == TRUE) {
exit(readTarFile(tarName, extractFlag, listFlag, tostdoutFlag, verboseFlag, excludeList));
}
diff --git a/cmdedit.c b/cmdedit.c
index e4c88c265..22831b10c 100644
--- a/cmdedit.c
+++ b/cmdedit.c
@@ -70,6 +70,12 @@ static struct history *his_end = NULL; /* Last element in command line list */
/* Current termio and the previous termio before starting sh */
struct termios initial_settings, new_settings;
+
+
+#ifndef _POSIX_VDISABLE
+#define _POSIX_VDISABLE '\0'
+#endif
+
#endif
diff --git a/fsck_minix.c b/fsck_minix.c
index 7d27566b8..1e482f3f9 100644
--- a/fsck_minix.c
+++ b/fsck_minix.c
@@ -97,6 +97,7 @@
#include <termios.h>
#include <mntent.h>
#include <sys/stat.h>
+#include <sys/param.h>
#include <linux/fs.h>
#include <linux/minix_fs.h>
diff --git a/internal.h b/internal.h
index 9c55f5a49..909bf6473 100644
--- a/internal.h
+++ b/internal.h
@@ -284,18 +284,6 @@ int nfsmount(const char *spec, const char *node, unsigned long *flags,
char **extra_opts, char **mount_opts, int running_bg);
#endif
-#if defined (BB_FSCK_MINIX) || defined (BB_MKFS_MINIX)
-/* Bit map related macros. */
-#ifndef setbit
-#define CHAR_BITS 8 /* Number of bits in a `char'. */
-#define setbit(a,i) ((a)[(i)/CHAR_BITS] |= 1<<((i)%CHAR_BITS))
-#define clrbit(a,i) ((a)[(i)/CHAR_BITS] &= ~(1<<((i)%CHAR_BITS)))
-#define isset(a,i) ((a)[(i)/CHAR_BITS] & (1<<((i)%CHAR_BITS)))
-#define isclr(a,i) (((a)[(i)/CHAR_BITS] & (1<<((i)%CHAR_BITS))) == 0)
-#endif
-#endif
-
-
#ifndef RB_POWER_OFF
/* Stop system and switch power off if possable. */
#define RB_POWER_OFF 0x4321fedc
diff --git a/mkfs_minix.c b/mkfs_minix.c
index f4f1d0997..c6f057a07 100644
--- a/mkfs_minix.c
+++ b/mkfs_minix.c
@@ -74,6 +74,7 @@
#include <termios.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
+#include <sys/param.h>
#include <mntent.h>
#include <linux/fs.h>
@@ -83,10 +84,6 @@
#define HAVE_MINIX2 1
#endif
-#ifndef __GNUC__
-#error "needs gcc for the bitop-__asm__'s"
-#endif
-
#ifndef __linux__
#define volatile
#endif
diff --git a/shell/cmdedit.c b/shell/cmdedit.c
index e4c88c265..22831b10c 100644
--- a/shell/cmdedit.c
+++ b/shell/cmdedit.c
@@ -70,6 +70,12 @@ static struct history *his_end = NULL; /* Last element in command line list */
/* Current termio and the previous termio before starting sh */
struct termios initial_settings, new_settings;
+
+
+#ifndef _POSIX_VDISABLE
+#define _POSIX_VDISABLE '\0'
+#endif
+
#endif
diff --git a/tar.c b/tar.c
index 6784d80ff..c5aad45d6 100644
--- a/tar.c
+++ b/tar.c
@@ -185,7 +185,7 @@ extern int tar_main(int argc, char **argv)
usage(tar_usage);
/* Parse any options */
- while (--argc > 0 && **(++argv) == '-') {
+ while (--argc > 0 && strspn(*(++argv), "-cxt") >0 ) {
stopIt=FALSE;
while (stopIt==FALSE && *(++(*argv))) {
switch (**argv) {
@@ -265,7 +265,8 @@ extern int tar_main(int argc, char **argv)
#else
exit(writeTarFile(tarName, tostdoutFlag, verboseFlag, argc, argv, excludeList));
#endif
- } else {
+ }
+ if (listFlag == TRUE || extractFlag == TRUE) {
exit(readTarFile(tarName, extractFlag, listFlag, tostdoutFlag, verboseFlag, excludeList));
}
diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c
index 7d27566b8..1e482f3f9 100644
--- a/util-linux/fsck_minix.c
+++ b/util-linux/fsck_minix.c
@@ -97,6 +97,7 @@
#include <termios.h>
#include <mntent.h>
#include <sys/stat.h>
+#include <sys/param.h>
#include <linux/fs.h>
#include <linux/minix_fs.h>
diff --git a/util-linux/mkfs_minix.c b/util-linux/mkfs_minix.c
index f4f1d0997..c6f057a07 100644
--- a/util-linux/mkfs_minix.c
+++ b/util-linux/mkfs_minix.c
@@ -74,6 +74,7 @@
#include <termios.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
+#include <sys/param.h>
#include <mntent.h>
#include <linux/fs.h>
@@ -83,10 +84,6 @@
#define HAVE_MINIX2 1
#endif
-#ifndef __GNUC__
-#error "needs gcc for the bitop-__asm__'s"
-#endif
-
#ifndef __linux__
#define volatile
#endif