upgrade busybox to v1.1.1
[openwrt/svn-archive/archive.git] / openwrt / package / busybox / patches / 500-hotfixes.patch
1 diff -Nur busybox-1.1.1/findutils/find.c busybox-1.1.1-owrt/findutils/find.c
2 --- busybox-1.1.1/findutils/find.c 2006-03-22 22:16:25.000000000 +0100
3 +++ busybox-1.1.1-owrt/findutils/find.c 2006-04-01 19:23:30.000000000 +0200
4 @@ -79,6 +79,15 @@
5
6 static int fileAction(const char *fileName, struct stat *statbuf, void* junk)
7 {
8 +#ifdef CONFIG_FEATURE_FIND_XDEV
9 + if (S_ISDIR(statbuf->st_mode) && xdev_count) {
10 + int i;
11 + for (i=0; i<xdev_count; i++) {
12 + if (xdev_dev[i] != statbuf->st_dev)
13 + return SKIP;
14 + }
15 + }
16 +#endif
17 if (pattern != NULL) {
18 const char *tmp = strrchr(fileName, '/');
19
20 @@ -125,21 +134,6 @@
21 goto no_match;
22 }
23 #endif
24 -#ifdef CONFIG_FEATURE_FIND_XDEV
25 - if (xdev_count) {
26 - int i;
27 - for (i=0; i<xdev_count; i++) {
28 - if (xdev_dev[i] == statbuf-> st_dev)
29 - break;
30 - }
31 - if (i == xdev_count) {
32 - if(S_ISDIR(statbuf->st_mode))
33 - return SKIP;
34 - else
35 - goto no_match;
36 - }
37 - }
38 -#endif
39 #ifdef CONFIG_FEATURE_FIND_NEWER
40 if (newer_mtime != 0) {
41 time_t file_age = newer_mtime - statbuf->st_mtime;
42 diff -Nur busybox-1.1.1/libbb/Makefile.in busybox-1.1.1-owrt/libbb/Makefile.in
43 --- busybox-1.1.1/libbb/Makefile.in 2006-03-22 22:16:22.000000000 +0100
44 +++ busybox-1.1.1-owrt/libbb/Makefile.in 2006-04-01 19:23:30.000000000 +0200
45 @@ -39,6 +39,7 @@
46 # conditionally compiled objects:
47 LIBBB-$(CONFIG_FEATURE_SHADOWPASSWDS)+=pwd2spwd.c
48 LIBBB-$(CONFIG_FEATURE_MOUNT_LOOP)+= loop.c
49 +LIBBB-$(CONFIG_LOSETUP)+= loop.c
50 LIBBB-$(CONFIG_FEATURE_MTAB_SUPPORT)+= mtab.c
51 LIBBB-$(CONFIG_PASSWD)+= pw_encrypt.c
52 LIBBB-$(CONFIG_SULOGIN)+= pw_encrypt.c
53 diff -Nur busybox-1.1.1/modutils/insmod.c busybox-1.1.1-owrt/modutils/insmod.c
54 --- busybox-1.1.1/modutils/insmod.c 2006-03-22 22:16:20.000000000 +0100
55 +++ busybox-1.1.1-owrt/modutils/insmod.c 2006-04-01 19:23:30.000000000 +0200
56 @@ -516,12 +516,6 @@
57 #include <elf.h>
58 #include <endian.h>
59
60 -#if BB_LITTLE_ENDIAN
61 -# define ELFDATAM ELFDATA2LSB
62 -#else
63 -# define ELFDATAM ELFDATA2MSB
64 -#endif
65 -
66 #ifndef ElfW
67 # if ELFCLASSM == ELFCLASS32
68 # define ElfW(x) Elf32_ ## x
69 @@ -3331,7 +3325,8 @@
70 return NULL;
71 }
72 if (f->header.e_ident[EI_CLASS] != ELFCLASSM
73 - || f->header.e_ident[EI_DATA] != ELFDATAM
74 + || f->header.e_ident[EI_DATA] != (BB_BIG_ENDIAN
75 + ? ELFDATA2MSB : ELFDATA2LSB)
76 || f->header.e_ident[EI_VERSION] != EV_CURRENT
77 || !MATCH_MACHINE(f->header.e_machine)) {
78 bb_error_msg("ELF file not for this architecture");
79 diff -Nur busybox-1.1.1/util-linux/Makefile.in busybox-1.1.1-owrt/util-linux/Makefile.in
80 --- busybox-1.1.1/util-linux/Makefile.in 2006-03-22 22:16:26.000000000 +0100
81 +++ busybox-1.1.1-owrt/util-linux/Makefile.in 2006-04-01 19:23:30.000000000 +0200
82 @@ -38,6 +38,8 @@
83 UTILLINUX-$(CONFIG_SWITCH_ROOT) +=switch_root.o
84 UTILLINUX-$(CONFIG_UMOUNT) +=umount.o
85
86 +UTILLINUX-y:=$(sort $(UTILLINUX-y))
87 +
88 ifneq ($(strip $(UTILLINUX-y)),)
89 libraries-y+=$(UTILLINUX_DIR)$(UTILLINUX_AR)
90 endif
91 diff -Nur busybox-1.1.1/util-linux/mount.c busybox-1.1.1-owrt/util-linux/mount.c
92 --- busybox-1.1.1/util-linux/mount.c 2006-03-22 22:16:26.000000000 +0100
93 +++ busybox-1.1.1-owrt/util-linux/mount.c 2006-04-01 19:23:30.000000000 +0200
94 @@ -184,6 +184,8 @@
95 {
96 llist_free(fslist);
97 }
98 +#else
99 +void delete_block_backed_filesystems(void);
100 #endif
101
102 #if ENABLE_FEATURE_MTAB_SUPPORT
103 @@ -196,12 +198,9 @@
104
105 // Perform actual mount of specific filesystem at specific location.
106
107 -static int mount_it_now(struct mntent *mp, int vfsflags)
108 +static int mount_it_now(struct mntent *mp, int vfsflags, char *filteropts)
109 {
110 int rc;
111 - char *filteropts = 0;
112 -
113 - parse_mount_options(mp->mnt_opts, &filteropts);
114
115 if (fakeIt) { return 0; }
116
117 @@ -217,8 +216,6 @@
118 vfsflags |= MS_RDONLY;
119 }
120
121 - free(filteropts);
122 -
123 // Abort entirely if permission denied.
124
125 if (rc && errno == EPERM)
126 @@ -266,11 +263,11 @@
127 static int singlemount(struct mntent *mp)
128 {
129 int rc = 1, vfsflags;
130 - char *loopFile = 0;
131 + char *loopFile = 0, *filteropts = 0;
132 llist_t *fl = 0;
133 struct stat st;
134
135 - vfsflags = parse_mount_options(mp->mnt_opts, 0);
136 + vfsflags = parse_mount_options(mp->mnt_opts, &filteropts);
137
138 // Treat fstype "auto" as unspecified.
139
140 @@ -282,16 +279,16 @@
141 (!mp->mnt_type || !strcmp(mp->mnt_type,"nfs")) &&
142 strchr(mp->mnt_fsname, ':') != NULL)
143 {
144 - char *options=0;
145 - parse_mount_options(mp->mnt_opts, &options);
146 - if (nfsmount(mp->mnt_fsname, mp->mnt_dir, &vfsflags, &options, 1)) {
147 + if (nfsmount(mp->mnt_fsname, mp->mnt_dir, &vfsflags, &filteropts, 1)) {
148 bb_perror_msg("nfsmount failed");
149 return 1;
150 + } else {
151 + // Strangely enough, nfsmount() doesn't actually mount() anything.
152 + rc = mount_it_now(mp, vfsflags, filteropts);
153 + if (ENABLE_FEATURE_CLEAN_UP) free(filteropts);
154 +
155 + return rc;
156 }
157 -
158 - // Strangely enough, nfsmount() doesn't actually mount() anything.
159 -
160 - else return mount_it_now(mp, vfsflags);
161 }
162
163 // Look at the file. (Not found isn't a failure for remount.)
164 @@ -324,7 +321,7 @@
165 * to the actual mount. */
166
167 if (mp->mnt_type || (vfsflags & (MS_REMOUNT | MS_BIND | MS_MOVE)))
168 - rc = mount_it_now(mp, vfsflags);
169 + rc = mount_it_now(mp, vfsflags, filteropts);
170
171 // Loop through filesystem types until mount succeeds or we run out
172
173 @@ -336,25 +333,26 @@
174
175 if (!fslist) {
176 fslist = get_block_backed_filesystems();
177 -#if ENABLE_FEATURE_CLEAN_UP
178 if (ENABLE_FEATURE_CLEAN_UP && fslist)
179 atexit(delete_block_backed_filesystems);
180 -#endif
181 }
182
183 for (fl = fslist; fl; fl = fl->link) {
184 mp->mnt_type = fl->data;
185
186 - if (!(rc = mount_it_now(mp,vfsflags))) break;
187 + if (!(rc = mount_it_now(mp,vfsflags, filteropts))) break;
188
189 mp->mnt_type = 0;
190 }
191 }
192
193 - // Mount failed. Clean up
194 + if (ENABLE_FEATURE_CLEAN_UP) free(filteropts);
195 +
196 + // If mount failed, clean up loop file (if any).
197 +
198 if (rc && loopFile) {
199 del_loop(mp->mnt_fsname);
200 - if(ENABLE_FEATURE_CLEAN_UP) {
201 + if (ENABLE_FEATURE_CLEAN_UP) {
202 free(loopFile);
203 free(mp->mnt_fsname);
204 }
205 @@ -548,7 +546,6 @@
206 if (ENABLE_FEATURE_CLEAN_UP) {
207 free(storage_path);
208 free(cmdopts);
209 - free(fstype);
210 }
211
212 if(rc)