Patchs from Jeff Garzik <jgarzik@mandrakesoft.com> to cleanup
authorEric Andersen <andersen@codepoet.org>
Fri, 9 Mar 2001 14:36:42 +0000 (14:36 -0000)
committerEric Andersen <andersen@codepoet.org>
Fri, 9 Mar 2001 14:36:42 +0000 (14:36 -0000)
warnings with glibc 2.2 and use always use xfopen
 -Erik

34 files changed:
cat.c
coreutils/cat.c
coreutils/df.c
coreutils/du.c
coreutils/head.c
coreutils/sort.c
coreutils/uname.c
coreutils/wc.c
dc.c
df.c
du.c
fbset.c
head.c
hostname.c
lsmod.c
miscutils/dc.c
miscutils/mktemp.c
miscutils/mt.c
mkfs_minix.c
mktemp.c
modutils/lsmod.c
mt.c
nc.c
networking/hostname.c
networking/nc.c
rdate.c
sort.c
swaponoff.c
uname.c
util-linux/fbset.c
util-linux/mkfs_minix.c
util-linux/rdate.c
util-linux/swaponoff.c
wc.c

diff --git a/cat.c b/cat.c
index 3554008..aa8528d 100644 (file)
--- a/cat.c
+++ b/cat.c
@@ -22,6 +22,7 @@
  */
 
 #include <stdlib.h>
+#include <string.h>
 #include "busybox.h"
 
 extern int cat_main(int argc, char **argv)
index 3554008..aa8528d 100644 (file)
@@ -22,6 +22,7 @@
  */
 
 #include <stdlib.h>
+#include <string.h>
 #include "busybox.h"
 
 extern int cat_main(int argc, char **argv)
index 485076f..776fceb 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <mntent.h>
 #include <sys/vfs.h>
 #include <getopt.h>
index 17ecfde..7cb888d 100644 (file)
@@ -28,6 +28,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <getopt.h>
+#include <string.h>
 #include <errno.h>
 #include "busybox.h"
 #define BB_DECLARE_EXTERN
@@ -196,7 +197,7 @@ int du_main(int argc, char **argv)
        return status;
 }
 
-/* $Id: du.c,v 1.42 2001/03/07 17:42:07 markw Exp $ */
+/* $Id: du.c,v 1.43 2001/03/09 14:36:42 andersen Exp $ */
 /*
 Local Variables:
 c-file-style: "linux"
index c683ec7..fac9ec6 100644 (file)
@@ -26,6 +26,7 @@
 #include <stdio.h>
 #include <getopt.h>
 #include <stdlib.h>
+#include <string.h>
 #include "busybox.h"
 
 int head(int len, FILE *fp)
index ed68722..79e629c 100644 (file)
@@ -22,6 +22,7 @@
  */
 
 #include <getopt.h>
+#include <string.h>
 #include <stdlib.h>
 #include "busybox.h"
 
index 4931ff1..f7e2291 100644 (file)
@@ -33,6 +33,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <sys/types.h>
 #include <sys/utsname.h>
 
index f2d33d6..5472c30 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <stdio.h>
 #include <getopt.h>
+#include <string.h>
 #include <stdlib.h>
 #include "busybox.h"
 
diff --git a/dc.c b/dc.c
index a422139..8d7a92a 100644 (file)
--- a/dc.c
+++ b/dc.c
@@ -2,6 +2,7 @@
 #include <ctype.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <unistd.h>
 #include <math.h>
 #include "busybox.h"
diff --git a/df.c b/df.c
index 485076f..776fceb 100644 (file)
--- a/df.c
+++ b/df.c
@@ -24,6 +24,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <mntent.h>
 #include <sys/vfs.h>
 #include <getopt.h>
diff --git a/du.c b/du.c
index 17ecfde..7cb888d 100644 (file)
--- a/du.c
+++ b/du.c
@@ -28,6 +28,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <getopt.h>
+#include <string.h>
 #include <errno.h>
 #include "busybox.h"
 #define BB_DECLARE_EXTERN
@@ -196,7 +197,7 @@ int du_main(int argc, char **argv)
        return status;
 }
 
-/* $Id: du.c,v 1.42 2001/03/07 17:42:07 markw Exp $ */
+/* $Id: du.c,v 1.43 2001/03/09 14:36:42 andersen Exp $ */
 /*
 Local Variables:
 c-file-style: "linux"
diff --git a/fbset.c b/fbset.c
index 72284a6..be1e3c3 100644 (file)
--- a/fbset.c
+++ b/fbset.c
@@ -198,8 +198,7 @@ static int readmode(struct fb_var_screeninfo *base, const char *fn,
        char buf[256];
        char *p = buf;
 
-       if ((f = fopen(fn, "r")) == NULL)
-               perror_msg_and_die("readmode(fopen)");
+       f = xfopen(fn, "r");
        while (!feof(f)) {
                fgets(buf, sizeof(buf), f);
                if ((p = strstr(buf, "mode ")) || (p = strstr(buf, "mode\t"))) {
diff --git a/head.c b/head.c
index c683ec7..fac9ec6 100644 (file)
--- a/head.c
+++ b/head.c
@@ -26,6 +26,7 @@
 #include <stdio.h>
 #include <getopt.h>
 #include <stdlib.h>
+#include <string.h>
 #include "busybox.h"
 
 int head(int len, FILE *fp)
index e1486b3..8ea8fe1 100644 (file)
@@ -1,6 +1,6 @@
 /* vi: set sw=4 ts=4: */
 /*
- * $Id: hostname.c,v 1.24 2001/02/14 21:23:06 andersen Exp $
+ * $Id: hostname.c,v 1.25 2001/03/09 14:36:42 andersen Exp $
  * Mini hostname implementation for busybox
  *
  * Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
@@ -30,6 +30,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <stdio.h>
+#include <stdlib.h>
 
 void do_sethostname(char *s, int isfile)
 {
diff --git a/lsmod.c b/lsmod.c
index a853db8..8251705 100644 (file)
--- a/lsmod.c
+++ b/lsmod.c
@@ -27,6 +27,7 @@
 
 #include <stdlib.h>
 #include <stdio.h>
+#include <string.h>
 #include <stddef.h>
 #include <errno.h>
 #include <unistd.h>
index a422139..8d7a92a 100644 (file)
@@ -2,6 +2,7 @@
 #include <ctype.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <unistd.h>
 #include <math.h>
 #include "busybox.h"
index 31ab9e2..bc47d0a 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <stdio.h>
 #include <errno.h>
+#include <string.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include "busybox.h"
index 350d3ae..250856f 100644 (file)
@@ -1,6 +1,7 @@
 /* vi: set sw=4 ts=4: */
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <sys/mtio.h>
 #include <sys/fcntl.h>
 #include "busybox.h"
index b666338..928a496 100644 (file)
@@ -683,10 +683,7 @@ char *filename;
        FILE *listfile;
        unsigned long blockno;
 
-       listfile = fopen(filename, "r");
-       if (listfile == (FILE *) NULL) {
-               error_msg_and_die("can't open file of bad blocks");
-       }
+       listfile = xfopen(filename, "r");
        while (!feof(listfile)) {
                fscanf(listfile, "%ld\n", &blockno);
                mark_zone(blockno);
index 31ab9e2..bc47d0a 100644 (file)
--- a/mktemp.c
+++ b/mktemp.c
@@ -24,6 +24,7 @@
 
 #include <stdio.h>
 #include <errno.h>
+#include <string.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include "busybox.h"
index a853db8..8251705 100644 (file)
@@ -27,6 +27,7 @@
 
 #include <stdlib.h>
 #include <stdio.h>
+#include <string.h>
 #include <stddef.h>
 #include <errno.h>
 #include <unistd.h>
diff --git a/mt.c b/mt.c
index 350d3ae..250856f 100644 (file)
--- a/mt.c
+++ b/mt.c
@@ -1,6 +1,7 @@
 /* vi: set sw=4 ts=4: */
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <sys/mtio.h>
 #include <sys/fcntl.h>
 #include "busybox.h"
diff --git a/nc.c b/nc.c
index e40d4b4..72439dd 100644 (file)
--- a/nc.c
+++ b/nc.c
@@ -28,6 +28,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <unistd.h>
 
 #include <sys/types.h>
index e1486b3..8ea8fe1 100644 (file)
@@ -1,6 +1,6 @@
 /* vi: set sw=4 ts=4: */
 /*
- * $Id: hostname.c,v 1.24 2001/02/14 21:23:06 andersen Exp $
+ * $Id: hostname.c,v 1.25 2001/03/09 14:36:42 andersen Exp $
  * Mini hostname implementation for busybox
  *
  * Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
@@ -30,6 +30,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <stdio.h>
+#include <stdlib.h>
 
 void do_sethostname(char *s, int isfile)
 {
index e40d4b4..72439dd 100644 (file)
@@ -28,6 +28,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <unistd.h>
 
 #include <sys/types.h>
diff --git a/rdate.c b/rdate.c
index a3ea3a8..ed7121a 100644 (file)
--- a/rdate.c
+++ b/rdate.c
@@ -28,6 +28,8 @@
 #include <netdb.h>
 #include <stdio.h>
 #include <getopt.h>
+#include <string.h>
+#include <time.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include "busybox.h"
diff --git a/sort.c b/sort.c
index ed68722..79e629c 100644 (file)
--- a/sort.c
+++ b/sort.c
@@ -22,6 +22,7 @@
  */
 
 #include <getopt.h>
+#include <string.h>
 #include <stdlib.h>
 #include "busybox.h"
 
index 0613fa1..9deb13a 100644 (file)
@@ -26,6 +26,7 @@
 #include <mntent.h>
 #include <dirent.h>
 #include <errno.h>
+#include <string.h>
 #include <stdlib.h>
 #include <sys/mount.h>
 #include <sys/syscall.h>
diff --git a/uname.c b/uname.c
index 4931ff1..f7e2291 100644 (file)
--- a/uname.c
+++ b/uname.c
@@ -33,6 +33,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <sys/types.h>
 #include <sys/utsname.h>
 
index 72284a6..be1e3c3 100644 (file)
@@ -198,8 +198,7 @@ static int readmode(struct fb_var_screeninfo *base, const char *fn,
        char buf[256];
        char *p = buf;
 
-       if ((f = fopen(fn, "r")) == NULL)
-               perror_msg_and_die("readmode(fopen)");
+       f = xfopen(fn, "r");
        while (!feof(f)) {
                fgets(buf, sizeof(buf), f);
                if ((p = strstr(buf, "mode ")) || (p = strstr(buf, "mode\t"))) {
index b666338..928a496 100644 (file)
@@ -683,10 +683,7 @@ char *filename;
        FILE *listfile;
        unsigned long blockno;
 
-       listfile = fopen(filename, "r");
-       if (listfile == (FILE *) NULL) {
-               error_msg_and_die("can't open file of bad blocks");
-       }
+       listfile = xfopen(filename, "r");
        while (!feof(listfile)) {
                fscanf(listfile, "%ld\n", &blockno);
                mark_zone(blockno);
index a3ea3a8..ed7121a 100644 (file)
@@ -28,6 +28,8 @@
 #include <netdb.h>
 #include <stdio.h>
 #include <getopt.h>
+#include <string.h>
+#include <time.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include "busybox.h"
index 0613fa1..9deb13a 100644 (file)
@@ -26,6 +26,7 @@
 #include <mntent.h>
 #include <dirent.h>
 #include <errno.h>
+#include <string.h>
 #include <stdlib.h>
 #include <sys/mount.h>
 #include <sys/syscall.h>
diff --git a/wc.c b/wc.c
index f2d33d6..5472c30 100644 (file)
--- a/wc.c
+++ b/wc.c
@@ -22,6 +22,7 @@
 
 #include <stdio.h>
 #include <getopt.h>
+#include <string.h>
 #include <stdlib.h>
 #include "busybox.h"