+++ /dev/null
-diff -Nur busybox-1.01-orig/include/libbb.h busybox-1.01/include/libbb.h
---- busybox-1.01-orig/include/libbb.h 2005-09-27 09:07:59.097072152 +0200
-+++ busybox-1.01/include/libbb.h 2005-09-27 17:08:02.912226664 +0200
-@@ -138,8 +138,8 @@
- extern char *find_real_root_device_name(void);
- extern char *bb_get_line_from_file(FILE *file);
- extern char *bb_get_chomped_line_from_file(FILE *file);
--extern int bb_copyfd_size(int fd1, int fd2, const off_t size);
--extern int bb_copyfd_eof(int fd1, int fd2);
-+extern off_t bb_copyfd_size(int fd1, int fd2, const off_t size);
-+extern off_t bb_copyfd_eof(int fd1, int fd2);
- extern void bb_xprint_and_close_file(FILE *file);
- extern int bb_xprint_file_by_name(const char *filename);
- extern char bb_process_escape_sequence(const char **ptr);
-@@ -195,6 +195,8 @@
- extern int safe_strtod(char *arg, double* value);
- extern int safe_strtol(char *arg, long* value);
- extern int safe_strtoul(char *arg, unsigned long* value);
-+extern int safe_strtoll(char *arg, long long* value);
-+extern int safe_strtoull(char *arg, unsigned long long* value);
-
- struct suffix_mult {
- const char *suffix;
-diff -Nur busybox-1.01-orig/libbb/copyfd.c busybox-1.01/libbb/copyfd.c
---- busybox-1.01-orig/libbb/copyfd.c 2005-08-17 03:29:14.000000000 +0200
-+++ busybox-1.01/libbb/copyfd.c 2005-09-27 17:11:40.083211656 +0200
-@@ -34,29 +34,25 @@
- #endif
-
-
--static size_t bb_full_fd_action(int src_fd, int dst_fd, const size_t size2)
-+static off_t bb_full_fd_action(int src_fd, int dst_fd, const off_t size2)
- {
- int status;
-- size_t xread, wrote, total, size = size2;
-+ ssize_t xread, wrote;
-+ off_t total, size = size2;
-
- if (src_fd < 0) {
- return -1;
- }
-
-- if (size == 0) {
-- /* If size is 0 copy until EOF */
-- size = ULONG_MAX;
-- }
--
- {
- RESERVE_CONFIG_BUFFER(buffer,BUFSIZ);
- total = 0;
- wrote = 0;
- status = -1;
-- while (total < size)
-+ while (total < size || size == 0)
- {
- xread = BUFSIZ;
-- if (size < (total + BUFSIZ))
-+ if (size < (total + BUFSIZ) && size != 0)
- xread = size - total;
- xread = bb_full_read(src_fd, buffer, xread);
- if (xread > 0) {
-@@ -90,7 +86,7 @@
- }
-
-
--extern int bb_copyfd_size(int fd1, int fd2, const off_t size)
-+extern off_t bb_copyfd_size(int fd1, int fd2, const off_t size)
- {
- if (size) {
- return(bb_full_fd_action(fd1, fd2, size));
-@@ -98,7 +94,7 @@
- return(0);
- }
-
--extern int bb_copyfd_eof(int fd1, int fd2)
-+extern off_t bb_copyfd_eof(int fd1, int fd2)
- {
- return(bb_full_fd_action(fd1, fd2, 0));
- }
-diff -Nur busybox-1.01-orig/libbb/Makefile.in busybox-1.01/libbb/Makefile.in
---- busybox-1.01-orig/libbb/Makefile.in 2005-08-17 03:29:14.000000000 +0200
-+++ busybox-1.01/libbb/Makefile.in 2005-09-27 17:08:02.913226512 +0200
-@@ -72,7 +72,7 @@
- xgetularg_bnd.o xgetularg10_bnd.o xgetularg10.o
-
- LIBBB_MSRC4:=$(srcdir)/safe_strtol.c
--LIBBB_MOBJ4:=safe_strtoi.o safe_strtod.o safe_strtol.o safe_strtoul.o
-+LIBBB_MOBJ4:=safe_strtoi.o safe_strtod.o safe_strtol.o safe_strtoul.o safe_strtoull.o safe_strtoll.o
-
- LIBBB_MOBJS0=$(patsubst %,$(LIBBB_DIR)%, $(LIBBB_MOBJ0))
- LIBBB_MOBJS1=$(patsubst %,$(LIBBB_DIR)%, $(LIBBB_MOBJ1))
-diff -Nur busybox-1.01-orig/libbb/safe_strtol.c busybox-1.01/libbb/safe_strtol.c
---- busybox-1.01-orig/libbb/safe_strtol.c 2005-08-17 03:29:14.000000000 +0200
-+++ busybox-1.01/libbb/safe_strtol.c 2005-09-27 17:08:02.914226360 +0200
-@@ -90,3 +90,38 @@
- }
- #endif
-
-+#ifdef L_safe_strtoll
-+extern
-+int safe_strtoll(char *arg, long long* value)
-+{
-+ char *endptr;
-+ int errno_save = errno;
-+
-+ assert(arg!=NULL);
-+ errno = 0;
-+ *value = strtoll(arg, &endptr, 0);
-+ if (errno != 0 || *endptr!='\0' || endptr==arg) {
-+ return 1;
-+ }
-+ errno = errno_save;
-+ return 0;
-+}
-+#endif
-+
-+#ifdef L_safe_strtoull
-+extern
-+int safe_strtoull(char *arg, unsigned long long* value)
-+{
-+ char *endptr;
-+ int errno_save = errno;
-+
-+ assert(arg!=NULL);
-+ errno = 0;
-+ *value = strtoull(arg, &endptr, 0);
-+ if (errno != 0 || *endptr!='\0' || endptr==arg) {
-+ return 1;
-+ }
-+ errno = errno_save;
-+ return 0;
-+}
-+#endif
-diff -Nur busybox-1.01-orig/networking/ftpgetput.c busybox-1.01/networking/ftpgetput.c
---- busybox-1.01-orig/networking/ftpgetput.c 2005-08-17 03:29:10.000000000 +0200
-+++ busybox-1.01/networking/ftpgetput.c 2005-09-27 17:08:02.914226360 +0200
-@@ -152,8 +152,12 @@
- fd_data = xconnect_ftpdata(server, buf);
-
- if (ftpcmd("SIZE ", server_path, control_stream, buf) == 213) {
-- unsigned long value=filesize;
-+ off_t value=filesize;
-+#ifdef CONFIG_LFS
-+ if (safe_strtoull(buf + 4, &value))
-+#else
- if (safe_strtoul(buf + 4, &value))
-+#endif
- bb_error_msg_and_die("SIZE error: %s", buf + 4);
- filesize = value;
- }
-@@ -176,7 +180,11 @@
- }
-
- if (do_continue) {
-+#ifdef CONFIG_LFS
-+ sprintf(buf, "REST %lld", (long long)beg_range);
-+#else
- sprintf(buf, "REST %ld", (long)beg_range);
-+#endif
- if (ftpcmd(buf, NULL, control_stream, buf) != 350) {
- do_continue = 0;
- } else {
-@@ -240,7 +248,11 @@
- fd_local = bb_xopen(local_path, O_RDONLY);
- fstat(fd_local, &sbuf);
-
-+#ifdef CONFIG_LFS
-+ sprintf(buf, "ALLO %llu", (unsigned long long)sbuf.st_size);
-+#else
- sprintf(buf, "ALLO %lu", (unsigned long)sbuf.st_size);
-+#endif
- response = ftpcmd(buf, NULL, control_stream, buf);
- switch (response) {
- case 200:
-diff -Nur busybox-1.01-orig/networking/wget.c busybox-1.01/networking/wget.c
---- busybox-1.01-orig/networking/wget.c 2005-08-17 03:29:10.000000000 +0200
-+++ busybox-1.01/networking/wget.c 2005-09-27 17:08:02.916226056 +0200
-@@ -389,8 +389,12 @@
- */
- while ((s = gethdr(buf, sizeof(buf), sfp, &n)) != NULL) {
- if (strcasecmp(buf, "content-length") == 0) {
-- unsigned long value;
-+ off_t value;
-+#ifdef CONFIG_LFS
-+ if (safe_strtoull(s, &value)) {
-+#else
- if (safe_strtoul(s, &value)) {
-+#endif
- close_delete_and_die("content-length %s is garbage", s);
- }
- filesize = value;
-@@ -460,8 +464,12 @@
- * Querying file size
- */
- if (ftpcmd("SIZE /", target.path, sfp, buf) == 213) {
-- unsigned long value;
-+ off_t value;
-+#ifdef CONFIG_LFS
-+ if (safe_strtoull(buf+4, &value)) {
-+#else
- if (safe_strtoul(buf+4, &value)) {
-+#endif
- close_delete_and_die("SIZE value is garbage");
- }
- filesize = value;
-@@ -502,7 +510,12 @@
- */
- if (chunked) {
- fgets(buf, sizeof(buf), dfp);
-+#ifdef CONFIG_LFS
-+ filesize = strtoll(buf, (char **) NULL, 16);
-+#else
- filesize = strtol(buf, (char **) NULL, 16);
-+#endif
-+
- }
- #ifdef CONFIG_FEATURE_WGET_STATUSBAR
- if (quiet_flag==FALSE)
-@@ -524,7 +537,11 @@
- if (chunked) {
- safe_fgets(buf, sizeof(buf), dfp); /* This is a newline */
- safe_fgets(buf, sizeof(buf), dfp);
-+#ifdef CONFIG_LFS
-+ filesize = strtoll(buf, (char **) NULL, 16);
-+#else
- filesize = strtol(buf, (char **) NULL, 16);
-+#endif
- if (filesize==0) {
- chunked = 0; /* all done! */
- }
+++ /dev/null
-diff -urN busybox-1.00-pre2.org/modutils/insmod.c busybox-1.00-pre2/modutils/insmod.c
---- busybox-1.00-pre2.org/modutils/insmod.c 2003-08-02 23:46:49.000000000 +0200
-+++ busybox-1.00-pre2/modutils/insmod.c 2003-08-05 23:34:53.000000000 +0200
-@@ -1890,6 +1890,9 @@
- struct obj_symbol *sym;
- char *name = (char *)s->name;
-
-+ if (strncmp(name, "GPLONLY_", 8) == 0)
-+ name += 8;
-+
- #ifdef SYMBOL_PREFIX
- /* Prepend SYMBOL_PREFIX to the symbol's name (the
- kernel exports `C names', but module object files
-
+++ /dev/null
-diff -urN busybox-1.00-pre3.org/include/applets.h busybox-1.00-pre3/include/applets.h
---- busybox-1.00-pre3.org/include/applets.h 2003-09-15 20:55:05.000000000 +0200
-+++ busybox-1.00-pre3/include/applets.h 2003-09-15 21:03:21.000000000 +0200
-@@ -283,6 +283,9 @@
- #ifdef CONFIG_INSMOD
- APPLET(insmod, insmod_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
- #endif
-+#ifdef CONFIG_FEATURE_REALLY_NEW_MODULE_INTERFACE
-+ APPLET(insmod_ng, insmod_ng_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
-+#endif
- #ifdef CONFIG_IP
- APPLET(ip, ip_main, _BB_DIR_BIN, _BB_SUID_NEVER)
- #endif
-diff -urN busybox-1.00-pre3.org/include/usage.h busybox-1.00-pre3/include/usage.h
---- busybox-1.00-pre3.org/include/usage.h 2003-09-15 20:55:05.000000000 +0200
-+++ busybox-1.00-pre3/include/usage.h 2003-09-15 21:03:24.000000000 +0200
-@@ -1318,6 +1318,11 @@
- #define insmod_ng_full_usage \
- "Loads the specified kernel modules into the kernel."
-
-+#define insmod_ng_trivial_usage \
-+ "MODULE [symbol=value]..."
-+#define insmod_ng_full_usage \
-+ "Loads the specified kernel modules into the kernel."
-+
- #define kill_trivial_usage \
- "[-signal] process-id [process-id ...]"
- #define kill_full_usage \
-diff -urN busybox-1.00-pre3.org/modutils/Config.in busybox-1.00-pre3/modutils/Config.in
---- busybox-1.00-pre3.org/modutils/Config.in 2003-09-15 20:55:05.000000000 +0200
-+++ busybox-1.00-pre3/modutils/Config.in 2003-09-15 21:03:24.000000000 +0200
-@@ -33,6 +33,15 @@
- Support module loading for newer (post 2.1) Linux kernels.
- endif
-
-+if CONFIG_FEATURE_NEW_MODULE_INTERFACE
-+config CONFIG_FEATURE_REALLY_NEW_MODULE_INTERFACE
-+ bool " Support new (port 2.5) Linux kernels"
-+ default y
-+ depends on CONFIG_INSMOD
-+ help
-+ Support module loading for newer (port 2.5) Linux kernels.
-+endif
-+
- config CONFIG_FEATURE_INSMOD_VERSION_CHECKING
- bool " Module version checking"
- default n
-diff -urN busybox-1.00-pre3.org/modutils/insmod.c busybox-1.00-pre3/modutils/insmod.c
---- busybox-1.00-pre3.org/modutils/insmod.c 2003-09-15 20:55:05.000000000 +0200
-+++ busybox-1.00-pre3/modutils/insmod.c 2003-09-15 21:03:25.000000000 +0200
-@@ -4141,6 +4141,14 @@
- }
- #endif
-
-+#ifdef CONFIG_FEATURE_REALLY_NEW_MODULE_INTERFACE
-+ if (create_module(NULL, 0) < 0 && errno == ENOSYS) {
-+ optind--;
-+ argv[optind] = m_filename;
-+ return insmod_ng_main(argc - optind, argv + optind);
-+ }
-+#endif
-+
- if ((f = obj_load(fp, LOADBITS)) == NULL)
- bb_perror_msg_and_die("Could not load the module");
-
-diff -urN busybox-1.00-pre3.org/modutils/insmod_ng.c busybox-1.00-pre3/modutils/insmod_ng.c
---- busybox-1.00-pre3.org/modutils/insmod_ng.c 1970-01-01 01:00:00.000000000 +0100
-+++ busybox-1.00-pre3/modutils/insmod_ng.c 2003-09-15 21:03:25.000000000 +0200
-@@ -0,0 +1,109 @@
-+/* vi: set sw=4 ts=4: */
-+/*
-+ * insmod for 2.5 kernels implementation for busybox
-+ * busybox version by Michal Moskal <malekith@pld-linux.org>
-+ *
-+ * Copyright (C) 2001 Rusty Russell.
-+ * Copyright (C) 2002 Rusty Russell, IBM Corporation.
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ */
-+
-+#include <string.h>
-+#include <stdlib.h>
-+#include <unistd.h>
-+#include <fcntl.h>
-+#include <sys/mman.h>
-+#include <sys/types.h>
-+#include <sys/stat.h>
-+#include <unistd.h>
-+#include <errno.h>
-+#include <asm/unistd.h>
-+#include <sys/syscall.h>
-+
-+#include "busybox.h"
-+
-+/* We use error numbers in a loose translation... */
-+static const char *moderror(int err)
-+{
-+ switch (err) {
-+ case ENOEXEC:
-+ return "Invalid module format";
-+ case ENOENT:
-+ return "Unknown symbol in module";
-+ case ESRCH:
-+ return "Module has wrong symbol version";
-+ case EINVAL:
-+ return "Invalid parameters";
-+ default:
-+ return strerror(err);
-+ }
-+}
-+
-+extern int insmod_ng_main(int argc, char **argv)
-+{
-+ int i;
-+ int fd;
-+ long int ret;
-+ struct stat st;
-+ unsigned long len;
-+ void *map;
-+ char *filename, *options = bb_xstrdup("");
-+
-+ filename = argv[1];
-+ if (!filename) {
-+ bb_show_usage();
-+ return -1;
-+ }
-+
-+ /* Rest is options */
-+ for (i = 2; i < argc; i++) {
-+ options = xrealloc(options,
-+ strlen(options) + 2 + strlen(argv[i]) + 2);
-+ /* Spaces handled by "" pairs, but no way of escaping quotes */
-+ if (strchr(argv[i], ' ')) {
-+ strcat(options, "\"");
-+ strcat(options, argv[i]);
-+ strcat(options, "\"");
-+ } else {
-+ strcat(options, argv[i]);
-+ }
-+ strcat(options, " ");
-+ }
-+
-+ if ((fd = open(filename, O_RDONLY, 0)) < 0)
-+ bb_perror_msg_and_die("cannot open module `%s'", filename);
-+
-+ fstat(fd, &st);
-+ len = st.st_size;
-+ map = mmap(NULL, len, PROT_READ, MAP_SHARED, fd, 0);
-+ if (map == MAP_FAILED)
-+ bb_perror_msg_and_die("cannot mmap `%s'", filename);
-+
-+ ret = init_module(map, len, options);
-+ if (ret != 0)
-+ bb_perror_msg_and_die("cannot insert `%s': %s (%li)",
-+ filename, moderror(errno), ret);
-+
-+ return 0;
-+}
-+
-+/*
-+Local Variables:
-+c-file-style: "linux"
-+c-basic-offset: 4
-+tab-width: 4
-+End:
-+*/
-diff -urN busybox-1.00-pre3.org/modutils/Makefile.in busybox-1.00-pre3/modutils/Makefile.in
---- busybox-1.00-pre3.org/modutils/Makefile.in 2003-09-15 20:55:05.000000000 +0200
-+++ busybox-1.00-pre3/modutils/Makefile.in 2003-09-15 21:03:25.000000000 +0200
-@@ -24,6 +24,7 @@
-
- MODUTILS-y:=
- MODUTILS-$(CONFIG_INSMOD) += insmod.o
-+MODUTILS-$(CONFIG_FEATURE_REALLY_NEW_MODULE_INTERFACE) += insmod_ng.o
- MODUTILS-$(CONFIG_LSMOD) += lsmod.o
- MODUTILS-$(CONFIG_MODPROBE) += modprobe.o
- MODUTILS-$(CONFIG_RMMOD) += rmmod.o
+++ /dev/null
---- busybox-1.1.0/util-linux/mdev.c.orig 2006-01-11 05:44:22.000000000 +0000
-+++ busybox-1.1.0/util-linux/mdev.c 2006-02-06 17:06:24.107287250 +0000
-@@ -1,7 +1,7 @@
- /* vi:set ts=4:
-- *
-+ *
- * mdev - Mini udev for busybox
-- *
-+ *
- * Copyright 2005 Rob Landley <rob@landley.net>
- * Copyright 2005 Frank Sorenson <frank@tuxrocks.com>
- *
-@@ -18,94 +18,90 @@
- #include <sys/stat.h>
- #include <sys/types.h>
- #include <unistd.h>
-+#include <stdlib.h>
- #include "busybox.h"
- #include "xregex.h"
-
- #define DEV_PATH "/dev"
-+#define MDEV_CONF "/etc/mdev.conf"
-
- #include <busybox.h>
-
- /* mknod in /dev based on a path like "/sys/block/hda/hda1" */
- static void make_device(char *path)
- {
-- char *device_name,*s;
-- int major,minor,type,len,fd;
-- int mode=0660;
-- uid_t uid=0;
-- gid_t gid=0;
-+ char *device_name, *s;
-+ int major, minor, type, len, fd;
-+ int mode = 0660;
-+ uid_t uid = 0;
-+ gid_t gid = 0;
-
-- RESERVE_CONFIG_BUFFER(temp,PATH_MAX);
-+ RESERVE_CONFIG_BUFFER(temp, PATH_MAX);
-
- /* Try to read major/minor string */
--
-+
- snprintf(temp, PATH_MAX, "%s/dev", path);
- fd = open(temp, O_RDONLY);
- len = read(fd, temp, PATH_MAX-1);
-- if (len<1) goto end;
-- temp[len] = 0;
- close(fd);
--
-+ if (len < 1) goto end;
-+
- /* Determine device name, type, major and minor */
--
-+
- device_name = strrchr(path, '/') + 1;
-- type = strncmp(path+5, "block/" ,6) ? S_IFCHR : S_IFBLK;
-- major = minor = 0;
-- for (s = temp; *s; s++) {
-- if (*s == ':') {
-- major = minor;
-- minor = 0;
-- } else {
-- minor *= 10;
-- minor += (*s) - '0';
-- }
-- }
-+ type = strncmp(path+5, "block/", 6) ? S_IFCHR : S_IFBLK;
-+ if (sscanf(temp, "%d:%d", &major, &minor) != 2)
-+ goto end;
-
- /* If we have a config file, look up permissions for this device */
--
-+
- if (ENABLE_FEATURE_MDEV_CONF) {
-- char *conf,*pos,*end;
-+ char *conf, *pos, *end;
-
- /* mmap the config file */
-- if (-1!=(fd=open("/etc/mdev.conf",O_RDONLY))) {
-- len=lseek(fd,0,SEEK_END);
-- conf=mmap(NULL,len,PROT_READ,MAP_PRIVATE,fd,0);
-+ if (-1 != (fd=open(MDEV_CONF,O_RDONLY))) {
-+ len = lseek(fd, 0, SEEK_END);
-+ conf = mmap(NULL, len, PROT_READ, MAP_PRIVATE, fd, 0);
- if (conf) {
-- int line=0;
-+ int line = 0;
-
- /* Loop through lines in mmaped file*/
-- for (pos=conf;pos-conf<len;) {
-+ for (pos=conf; pos-conf<len;) {
- int field;
- char *end2;
--
-+
- line++;
- /* find end of this line */
-- for(end=pos;end-conf<len && *end!='\n';end++);
-+ for(end=pos; end-conf<len && *end!='\n'; end++)
-+ ;
-
- /* Three fields: regex, uid:gid, mode */
-- for (field=3;field;field--) {
-+ for (field=3; field; field--) {
- /* Skip whitespace */
-- while (pos<end && isspace(*pos)) pos++;
-- if (pos==end || *pos=='#') break;
-- for (end2=pos;
-- end2<end && !isspace(*end2) && *end2!='#'; end2++);
-- switch(field) {
-+ while (pos<end && isspace(*pos))
-+ pos++;
-+ if (pos==end || *pos=='#')
-+ break;
-+ for (end2=pos; end2<end && !isspace(*end2) && *end2!='#'; end2++)
-+ ;
-+
-+ switch (field) {
- /* Regex to match this device */
- case 3:
- {
-- char *regex=strndupa(pos,end2-pos);
-+ char *regex = strndupa(pos,end2-pos);
- regex_t match;
- regmatch_t off;
- int result;
-
-- /* Is this it? */
-+ /* Is this it? */
- xregcomp(&match,regex,REG_EXTENDED);
-- result=regexec(&match,device_name,1,&off,0);
-+ result = regexec(&match,device_name,1,&off,0);
- regfree(&match);
--
-+
- /* If not this device, skip rest of line */
-- if(result || off.rm_so
-- || off.rm_eo!=strlen(device_name))
-- goto end_line;
-+ if (result || off.rm_so || off.rm_eo!=strlen(device_name))
-+ goto end_line;
-
- break;
- }
-@@ -115,48 +111,54 @@
- char *s2;
-
- /* Find : */
-- for(s=pos;s<end2 && *s!=':';s++);
-- if(s==end2) goto end_line;
-+ for(s=pos; s<end2 && *s!=':'; s++)
-+ ;
-+ if (s == end2)
-+ goto end_line;
-
- /* Parse UID */
-- uid=strtoul(pos,&s2,10);
-- if(s!=s2) {
-+ uid = strtoul(pos,&s2,10);
-+ if (s != s2) {
- struct passwd *pass;
-- pass=getpwnam(strndupa(pos,s-pos));
-- if(!pass) goto end_line;
-- uid=pass->pw_uid;
-+ pass = getpwnam(strndupa(pos,s-pos));
-+ if (!pass)
-+ goto end_line;
-+ uid = pass->pw_uid;
- }
- s++;
- /* parse GID */
-- gid=strtoul(s,&s2,10);
-- if(end2!=s2) {
-+ gid = strtoul(s,&s2,10);
-+ if (end2 != s2) {
- struct group *grp;
-- grp=getgrnam(strndupa(s,end2-s));
-- if(!grp) goto end_line;
-- gid=grp->gr_gid;
-+ grp = getgrnam(strndupa(s,end2-s));
-+ if (!grp)
-+ goto end_line;
-+ gid = grp->gr_gid;
- }
- break;
- }
- /* mode */
- case 1:
- {
-- mode=strtoul(pos,&pos,8);
-- if(pos!=end2) goto end_line;
-- goto found_device;
-+ mode = strtoul(pos,&pos,8);
-+ if (pos != end2)
-+ goto end_line;
-+ else
-+ goto found_device;
- }
- }
-- pos=end2;
-+ pos = end2;
- }
- end_line:
- /* Did everything parse happily? */
- if (field && field!=3)
-- bb_error_msg_and_die("Bad line %d",line);
-+ bb_error_msg_and_die("Bad line %d",line);
-
- /* Next line */
-- pos=++end;
-+ pos = ++end;
- }
- found_device:
-- munmap(conf,len);
-+ munmap(conf, len);
- }
- close(fd);
- }
-@@ -168,7 +170,7 @@
- bb_perror_msg_and_die("mknod %s failed", temp);
-
- if (ENABLE_FEATURE_MDEV_CONF) chown(temp,uid,gid);
--
-+
- end:
- RELEASE_CONFIG_BUFFER(temp);
- }
-@@ -179,50 +181,64 @@
- static void find_dev(char *path)
- {
- DIR *dir;
-- int len=strlen(path);
-+ size_t len = strlen(path);
-+ struct dirent *entry;
-
-- if (!(dir = opendir(path)))
-- bb_perror_msg_and_die("No %s",path);
-+ if ((dir = opendir(path)) == NULL)
-+ return;
-
-- for (;;) {
-- struct dirent *entry = readdir(dir);
--
-- if (!entry) break;
-+ while ((entry = readdir(dir)) != NULL) {
-
- /* Skip "." and ".." (also skips hidden files, which is ok) */
-
-- if (entry->d_name[0]=='.') continue;
-+ if (entry->d_name[0] == '.')
-+ continue;
-
- if (entry->d_type == DT_DIR) {
- snprintf(path+len, PATH_MAX-len, "/%s", entry->d_name);
- find_dev(path);
- path[len] = 0;
- }
--
-+
- /* If there's a dev entry, mknod it */
--
-- if (strcmp(entry->d_name, "dev")) make_device(path);
-+
-+ if (!strcmp(entry->d_name, "dev")) make_device(path);
- }
--
-+
- closedir(dir);
- }
-
- int mdev_main(int argc, char *argv[])
- {
-- if (argc > 1) {
-- if (argc == 2 && !strcmp(argv[1],"-s")) {
-- RESERVE_CONFIG_BUFFER(temp,PATH_MAX);
-- strcpy(temp,"/sys/block");
-- find_dev(temp);
-- strcpy(temp,"/sys/class");
-- find_dev(temp);
-- if(ENABLE_FEATURE_CLEAN_UP)
-- RELEASE_CONFIG_BUFFER(temp);
-- return 0;
-- } else bb_show_usage();
-- }
--
--/* hotplug support goes here */
--
-+ char *action;
-+ char *env_path;
-+ RESERVE_CONFIG_BUFFER(temp,PATH_MAX);
-+
-+ /* Scan */
-+
-+ if (argc == 2 && !strcmp(argv[1],"-s")) {
-+ strcpy(temp,"/sys/block");
-+ find_dev(temp);
-+ strcpy(temp,"/sys/class");
-+ find_dev(temp);
-+
-+ /* Hotplug */
-+
-+ } else {
-+ action = getenv("ACTION");
-+ env_path = getenv("DEVPATH");
-+ if (!action || !env_path)
-+ bb_show_usage();
-+
-+ if (!strcmp(action, "add")) {
-+ sprintf(temp, "/sys%s", env_path);
-+ make_device(temp);
-+ } else if (!strcmp(action, "remove")) {
-+ sprintf(temp, "%s/%s", DEV_PATH, strrchr(env_path, '/') + 1);
-+ unlink(temp);
-+ }
-+ }
-+
-+ if (ENABLE_FEATURE_CLEAN_UP) RELEASE_CONFIG_BUFFER(temp);
- return 0;
- }
+++ /dev/null
-diff -Nur --exclude *~ busybox-0.51/busybox.c busybox-0.51.new/busybox.c
---- busybox-0.51/busybox.c Tue Apr 10 00:48:11 2001
-+++ busybox-0.51.new/busybox.c Sun May 20 12:43:53 2001
-@@ -94,6 +94,8 @@
- }
-
- #ifdef BB_SH
-+ if (strcmp(applet_name, "lash")==0) applet_name="sh";
-+
- /* Add in a special case hack -- whenever **argv == '-'
- * (i.e. '-su' or '-sh') always invoke the shell */
- if (**argv == '-' && *(*argv+1)!= '-') {
+++ /dev/null
-diff -urN busybox-1.00-pre2.org/coreutils/tee.c busybox-1.00-pre2/coreutils/tee.c
---- busybox-1.00-pre2.org/coreutils/tee.c 2003-08-02 23:31:11.000000000 +0200
-+++ busybox-1.00-pre2/coreutils/tee.c 2003-08-02 23:32:33.000000000 +0200
-@@ -89,6 +89,7 @@
- #endif
-
- #else
-+ setvbuf(stdout, NULL, _IONBF, 0);
- while ((c = getchar()) != EOF) {
- for (p=files ; *p ; p++) {
- putc(c, *p);