aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-06-19 17:50:44 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2010-06-19 17:50:44 +0200
commit020465218ccff1195a47a890037db37d0395c9d9 (patch)
tree491ffc11553f9de9b91c890f82dc0668c44660e8
parente329089c62ed813e97344f8c61d7dc34221fd5ee (diff)
parent8cd9f343e74ca65f36c42a44e845716ba5411663 (diff)
downloadbusybox-w32-020465218ccff1195a47a890037db37d0395c9d9.tar.gz
busybox-w32-020465218ccff1195a47a890037db37d0395c9d9.tar.bz2
busybox-w32-020465218ccff1195a47a890037db37d0395c9d9.zip
Merge branch 'master' of git+ssh://vda@busybox.net/var/lib/git/busybox
-rw-r--r--.gitignore1
-rw-r--r--archival/unzip.c13
-rw-r--r--e2fsprogs/old_e2fsprogs/e2fsck.c4
-rw-r--r--libbb/get_line_from_file.c5
-rw-r--r--modutils/depmod.c2
-rw-r--r--shell/ash.c46
-rw-r--r--shell/ash_test/ash-standalone/var_standalone1.right1
-rwxr-xr-xshell/ash_test/ash-standalone/var_standalone1.tests2
-rwxr-xr-xtestsuite/cpio.tests6
-rw-r--r--util-linux/Config.src6
-rw-r--r--util-linux/hwclock.c7
-rw-r--r--util-linux/mkfs_ext2.c13
12 files changed, 40 insertions, 66 deletions
diff --git a/.gitignore b/.gitignore
index b7840e494..53bd540a2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,6 +6,7 @@
6*.o.* 6*.o.*
7*.a 7*.a
8*.s 8*.s
9Kbuild
9 10
10# 11#
11# Never ignore these 12# Never ignore these
diff --git a/archival/unzip.c b/archival/unzip.c
index 1d3291ab8..84081c021 100644
--- a/archival/unzip.c
+++ b/archival/unzip.c
@@ -150,23 +150,26 @@ enum { zip_fd = 3 };
150 150
151 151
152#if ENABLE_DESKTOP 152#if ENABLE_DESKTOP
153
154#define PEEK_FROM_END 16384
155
153/* NB: does not preserve file position! */ 156/* NB: does not preserve file position! */
154static uint32_t find_cdf_offset(void) 157static uint32_t find_cdf_offset(void)
155{ 158{
156 unsigned char buf[1024];
157 cde_header_t cde_header; 159 cde_header_t cde_header;
158 unsigned char *p; 160 unsigned char *p;
159 off_t end; 161 off_t end;
162 unsigned char *buf = xzalloc(PEEK_FROM_END);
160 163
161 end = xlseek(zip_fd, 0, SEEK_END); 164 end = xlseek(zip_fd, 0, SEEK_END);
162 end -= 1024; 165 end -= PEEK_FROM_END;
163 if (end < 0) 166 if (end < 0)
164 end = 0; 167 end = 0;
165 xlseek(zip_fd, end, SEEK_SET); 168 xlseek(zip_fd, end, SEEK_SET);
166 full_read(zip_fd, buf, 1024); 169 full_read(zip_fd, buf, PEEK_FROM_END);
167 170
168 p = buf; 171 p = buf;
169 while (p <= buf + 1024 - CDE_HEADER_LEN - 4) { 172 while (p <= buf + PEEK_FROM_END - CDE_HEADER_LEN - 4) {
170 if (*p != 'P') { 173 if (*p != 'P') {
171 p++; 174 p++;
172 continue; 175 continue;
@@ -180,8 +183,10 @@ static uint32_t find_cdf_offset(void)
180 /* we found CDE! */ 183 /* we found CDE! */
181 memcpy(cde_header.raw, p + 1, CDE_HEADER_LEN); 184 memcpy(cde_header.raw, p + 1, CDE_HEADER_LEN);
182 FIX_ENDIANNESS_CDE(cde_header); 185 FIX_ENDIANNESS_CDE(cde_header);
186 free(buf);
183 return cde_header.formatted.cdf_offset; 187 return cde_header.formatted.cdf_offset;
184 } 188 }
189 //free(buf);
185 bb_error_msg_and_die("can't find file table"); 190 bb_error_msg_and_die("can't find file table");
186}; 191};
187 192
diff --git a/e2fsprogs/old_e2fsprogs/e2fsck.c b/e2fsprogs/old_e2fsprogs/e2fsck.c
index 7384bc453..4c4c78d00 100644
--- a/e2fsprogs/old_e2fsprogs/e2fsck.c
+++ b/e2fsprogs/old_e2fsprogs/e2fsck.c
@@ -29,10 +29,6 @@
29 * Licensed under GPLv2 or later, see file License in this tarball for details. 29 * Licensed under GPLv2 or later, see file License in this tarball for details.
30 */ 30 */
31 31
32#ifndef _GNU_SOURCE
33#define _GNU_SOURCE 1 /* get strnlen() */
34#endif
35
36#include "e2fsck.h" /*Put all of our defines here to clean things up*/ 32#include "e2fsck.h" /*Put all of our defines here to clean things up*/
37 33
38#define _(x) x 34#define _(x) x
diff --git a/libbb/get_line_from_file.c b/libbb/get_line_from_file.c
index 3cb46d240..cbfb45b7c 100644
--- a/libbb/get_line_from_file.c
+++ b/libbb/get_line_from_file.c
@@ -9,11 +9,6 @@
9 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 9 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
10 */ 10 */
11 11
12/* for getline() [GNUism]
13#ifndef _GNU_SOURCE
14#define _GNU_SOURCE 1
15#endif
16*/
17#include "libbb.h" 12#include "libbb.h"
18 13
19/* This function reads an entire line from a text file, up to a newline 14/* This function reads an entire line from a text file, up to a newline
diff --git a/modutils/depmod.c b/modutils/depmod.c
index 4718c4dcb..c734f142b 100644
--- a/modutils/depmod.c
+++ b/modutils/depmod.c
@@ -8,8 +8,6 @@
8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
9 */ 9 */
10 10
11#undef _GNU_SOURCE
12#define _GNU_SOURCE
13#include "libbb.h" 11#include "libbb.h"
14#include "modutils.h" 12#include "modutils.h"
15#include <sys/utsname.h> /* uname() */ 13#include <sys/utsname.h> /* uname() */
diff --git a/shell/ash.c b/shell/ash.c
index 90680e849..f581b5bdf 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -36,16 +36,11 @@
36 36
37#define JOBS ENABLE_ASH_JOB_CONTROL 37#define JOBS ENABLE_ASH_JOB_CONTROL
38 38
39#if DEBUG
40# ifndef _GNU_SOURCE
41# define _GNU_SOURCE
42# endif
43#endif
44
45#include "busybox.h" /* for applet_names */ 39#include "busybox.h" /* for applet_names */
46#include <paths.h> 40#include <paths.h>
47#include <setjmp.h> 41#include <setjmp.h>
48#include <fnmatch.h> 42#include <fnmatch.h>
43#include <sys/times.h>
49 44
50#include "shell_common.h" 45#include "shell_common.h"
51#include "math.h" 46#include "math.h"
@@ -7251,6 +7246,7 @@ tryexec(IF_FEATURE_SH_STANDALONE(int applet_no,) char *cmd, char **argv, char **
7251#if ENABLE_FEATURE_SH_STANDALONE 7246#if ENABLE_FEATURE_SH_STANDALONE
7252 if (applet_no >= 0) { 7247 if (applet_no >= 0) {
7253 if (APPLET_IS_NOEXEC(applet_no)) { 7248 if (APPLET_IS_NOEXEC(applet_no)) {
7249 clearenv();
7254 while (*envp) 7250 while (*envp)
7255 putenv(*envp++); 7251 putenv(*envp++);
7256 run_applet_no_and_exit(applet_no, argv); 7252 run_applet_no_and_exit(applet_no, argv);
@@ -7310,7 +7306,7 @@ shellexec(char **argv, const char *path, int idx)
7310#endif 7306#endif
7311 7307
7312 clearredir(/*drop:*/ 1); 7308 clearredir(/*drop:*/ 1);
7313 envp = listvars(VEXPORT, VUNSET, 0); 7309 envp = listvars(VEXPORT, VUNSET, /*end:*/ NULL);
7314 if (strchr(argv[0], '/') != NULL 7310 if (strchr(argv[0], '/') != NULL
7315#if ENABLE_FEATURE_SH_STANDALONE 7311#if ENABLE_FEATURE_SH_STANDALONE
7316 || (applet_no = find_applet_by_name(argv[0])) >= 0 7312 || (applet_no = find_applet_by_name(argv[0])) >= 0
@@ -12468,7 +12464,7 @@ unsetfunc(const char *name)
12468 struct tblentry *cmdp; 12464 struct tblentry *cmdp;
12469 12465
12470 cmdp = cmdlookup(name, 0); 12466 cmdp = cmdlookup(name, 0);
12471 if (cmdp!= NULL && cmdp->cmdtype == CMDFUNCTION) 12467 if (cmdp != NULL && cmdp->cmdtype == CMDFUNCTION)
12472 delete_cmd_entry(); 12468 delete_cmd_entry();
12473} 12469}
12474 12470
@@ -12485,7 +12481,7 @@ unsetcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
12485 int flag = 0; 12481 int flag = 0;
12486 int ret = 0; 12482 int ret = 0;
12487 12483
12488 while ((i = nextopt("vf")) != '\0') { 12484 while ((i = nextopt("vf")) != 0) {
12489 flag = i; 12485 flag = i;
12490 } 12486 }
12491 12487
@@ -12502,11 +12498,6 @@ unsetcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
12502 return ret & 1; 12498 return ret & 1;
12503} 12499}
12504 12500
12505
12506/* setmode.c */
12507
12508#include <sys/times.h>
12509
12510static const unsigned char timescmd_str[] ALIGN1 = { 12501static const unsigned char timescmd_str[] ALIGN1 = {
12511 ' ', offsetof(struct tms, tms_utime), 12502 ' ', offsetof(struct tms, tms_utime),
12512 '\n', offsetof(struct tms, tms_stime), 12503 '\n', offsetof(struct tms, tms_stime),
@@ -12514,11 +12505,10 @@ static const unsigned char timescmd_str[] ALIGN1 = {
12514 '\n', offsetof(struct tms, tms_cstime), 12505 '\n', offsetof(struct tms, tms_cstime),
12515 0 12506 0
12516}; 12507};
12517
12518static int FAST_FUNC 12508static int FAST_FUNC
12519timescmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) 12509timescmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
12520{ 12510{
12521 long clk_tck, s, t; 12511 unsigned long clk_tck, s, t;
12522 const unsigned char *p; 12512 const unsigned char *p;
12523 struct tms buf; 12513 struct tms buf;
12524 12514
@@ -12529,18 +12519,20 @@ timescmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
12529 do { 12519 do {
12530 t = *(clock_t *)(((char *) &buf) + p[1]); 12520 t = *(clock_t *)(((char *) &buf) + p[1]);
12531 s = t / clk_tck; 12521 s = t / clk_tck;
12532 out1fmt("%ldm%ld.%.3lds%c", 12522 t = t % clk_tck;
12533 s/60, s%60, 12523 out1fmt("%lum%lu.%03lus%c",
12534 ((t - s * clk_tck) * 1000) / clk_tck, 12524 s / 60, s % 60,
12525 (t * 1000) / clk_tck,
12535 p[0]); 12526 p[0]);
12536 } while (*(p += 2)); 12527 p += 2;
12528 } while (*p);
12537 12529
12538 return 0; 12530 return 0;
12539} 12531}
12540 12532
12541#if ENABLE_SH_MATH_SUPPORT 12533#if ENABLE_SH_MATH_SUPPORT
12542/* 12534/*
12543 * The let builtin. partial stolen from GNU Bash, the Bourne Again SHell. 12535 * The let builtin. Partially stolen from GNU Bash, the Bourne Again SHell.
12544 * Copyright (C) 1987, 1989, 1991 Free Software Foundation, Inc. 12536 * Copyright (C) 1987, 1989, 1991 Free Software Foundation, Inc.
12545 * 12537 *
12546 * Copyright (C) 2003 Vladimir Oleynik <dzo@simtreas.ru> 12538 * Copyright (C) 2003 Vladimir Oleynik <dzo@simtreas.ru>
@@ -12559,18 +12551,6 @@ letcmd(int argc UNUSED_PARAM, char **argv)
12559 12551
12560 return !i; 12552 return !i;
12561} 12553}
12562#endif /* SH_MATH_SUPPORT */
12563
12564
12565/* ============ miscbltin.c
12566 *
12567 * Miscellaneous builtins.
12568 */
12569
12570#undef rflag
12571
12572#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ < 1
12573typedef enum __rlimit_resource rlim_t;
12574#endif 12554#endif
12575 12555
12576/* 12556/*
diff --git a/shell/ash_test/ash-standalone/var_standalone1.right b/shell/ash_test/ash-standalone/var_standalone1.right
new file mode 100644
index 000000000..37457fd74
--- /dev/null
+++ b/shell/ash_test/ash-standalone/var_standalone1.right
@@ -0,0 +1 @@
Done: 1
diff --git a/shell/ash_test/ash-standalone/var_standalone1.tests b/shell/ash_test/ash-standalone/var_standalone1.tests
new file mode 100755
index 000000000..1e905ba75
--- /dev/null
+++ b/shell/ash_test/ash-standalone/var_standalone1.tests
@@ -0,0 +1,2 @@
1VAR=42 $THIS_SH -c 'unset VAR; env | grep ^VAR'
2echo Done: $?
diff --git a/testsuite/cpio.tests b/testsuite/cpio.tests
index 42e3ff8dc..5b397b01c 100755
--- a/testsuite/cpio.tests
+++ b/testsuite/cpio.tests
@@ -97,14 +97,14 @@ usr
97" "" "" 97" "" ""
98SKIP= 98SKIP=
99 99
100# chown on a link was affecting file, dropping its sgid bits 100# chown on a link was affecting file, dropping its suid/sgid bits
101rm -rf cpio.testdir 101rm -rf cpio.testdir
102optional FEATURE_CPIO_O 102optional FEATURE_CPIO_O
103mkdir cpio.testdir 103mkdir cpio.testdir
104touch cpio.testdir/file 104touch cpio.testdir/file
105chmod 6755 cpio.testdir/file # set the suid/sgid bit 105chmod 6755 cpio.testdir/file # sets suid/sgid bits
106ln -sf file cpio.testdir/link 106ln -sf file cpio.testdir/link
107testing "cpio restores sgid bits" \ 107testing "cpio restores suid/sgid bits" \
108"cd cpio.testdir && { echo file; echo link; } | cpio -ovHnewc >pack.cpio && rm ???? && cpio -idmvu <pack.cpio 2>/dev/null; 108"cd cpio.testdir && { echo file; echo link; } | cpio -ovHnewc >pack.cpio && rm ???? && cpio -idmvu <pack.cpio 2>/dev/null;
109 stat -c '%a %n' file" \ 109 stat -c '%a %n' file" \
110"\ 110"\
diff --git a/util-linux/Config.src b/util-linux/Config.src
index e97125917..3c3e05ec4 100644
--- a/util-linux/Config.src
+++ b/util-linux/Config.src
@@ -472,7 +472,7 @@ config FEATURE_USE_TERMIOS
472 472
473config VOLUMEID 473config VOLUMEID
474 bool #No description makes it a hidden option 474 bool #No description makes it a hidden option
475 default y 475 default n
476 476
477config FEATURE_VOLUMEID_EXT 477config FEATURE_VOLUMEID_EXT
478 bool "Ext filesystem" 478 bool "Ext filesystem"
@@ -725,7 +725,7 @@ config FEATURE_MOUNT_HELPERS
725 The idea is to use such virtual filesystems in /etc/fstab. 725 The idea is to use such virtual filesystems in /etc/fstab.
726 726
727config FEATURE_MOUNT_LABEL 727config FEATURE_MOUNT_LABEL
728 bool "Support specifiying devices by label or UUID" 728 bool "Support specifying devices by label or UUID"
729 default y 729 default y
730 depends on MOUNT 730 depends on MOUNT
731 select VOLUMEID 731 select VOLUMEID
@@ -930,7 +930,7 @@ config FEATURE_MTAB_SUPPORT
930 If you must use this, keep in mind it's inherently brittle (for 930 If you must use this, keep in mind it's inherently brittle (for
931 example a mount under chroot won't update it), can't handle modern 931 example a mount under chroot won't update it), can't handle modern
932 features like separate per-process filesystem namespaces, requires 932 features like separate per-process filesystem namespaces, requires
933 that your /etc directory be writeable, tends to get easily confused 933 that your /etc directory be writable, tends to get easily confused
934 by --bind or --move mounts, won't update if you rename a directory 934 by --bind or --move mounts, won't update if you rename a directory
935 that contains a mount point, and so on. (In brief: avoid.) 935 that contains a mount point, and so on. (In brief: avoid.)
936 936
diff --git a/util-linux/hwclock.c b/util-linux/hwclock.c
index 416271b31..3da2e23c3 100644
--- a/util-linux/hwclock.c
+++ b/util-linux/hwclock.c
@@ -12,13 +12,6 @@
12#include <sys/utsname.h> 12#include <sys/utsname.h>
13#include "rtc_.h" 13#include "rtc_.h"
14 14
15#if ENABLE_FEATURE_HWCLOCK_LONG_OPTIONS
16# ifndef _GNU_SOURCE
17# define _GNU_SOURCE
18# endif
19#endif
20
21
22/* diff code is disabled: it's not sys/hw clock diff, it's some useless 15/* diff code is disabled: it's not sys/hw clock diff, it's some useless
23 * "time between hwclock was started and we saw CMOS tick" quantity. 16 * "time between hwclock was started and we saw CMOS tick" quantity.
24 * It's useless since hwclock is started at a random moment, 17 * It's useless since hwclock is started at a random moment,
diff --git a/util-linux/mkfs_ext2.c b/util-linux/mkfs_ext2.c
index fd54734fc..14feb9288 100644
--- a/util-linux/mkfs_ext2.c
+++ b/util-linux/mkfs_ext2.c
@@ -140,7 +140,7 @@ static void PUT(uint64_t off, void *buf, uint32_t size)
140// only for directories, which never need i_size_high). 140// only for directories, which never need i_size_high).
141// 141//
142// Standard mke2fs creates a filesystem with 256-byte inodes if it is 142// Standard mke2fs creates a filesystem with 256-byte inodes if it is
143// bigger than 0.5GB. So far, we do not do this. 143// bigger than 0.5GB.
144 144
145// Standard mke2fs 1.41.9: 145// Standard mke2fs 1.41.9:
146// Usage: mke2fs [-c|-l filename] [-b block-size] [-f fragment-size] 146// Usage: mke2fs [-c|-l filename] [-b block-size] [-f fragment-size]
@@ -210,17 +210,20 @@ int mkfs_ext2_main(int argc UNUSED_PARAM, char **argv)
210 210
211 // using global "option_mask32" instead of local "opts": 211 // using global "option_mask32" instead of local "opts":
212 // we are register starved here 212 // we are register starved here
213 opt_complementary = "-1:b+:m+:i+"; 213 opt_complementary = "-1:b+:i+:I+:m+";
214 /*opts =*/ getopt32(argv, "cl:b:f:i:I:J:G:N:m:o:g:L:M:O:r:E:T:U:jnqvFS", 214 /*opts =*/ getopt32(argv, "cl:b:f:i:I:J:G:N:m:o:g:L:M:O:r:E:T:U:jnqvFS",
215 NULL, &bs, NULL, &bpi, &user_inodesize, NULL, NULL, NULL, 215 /*lbfi:*/ NULL, &bs, NULL, &bpi,
216 &reserved_percent, NULL, NULL, &label, NULL, NULL, NULL, NULL, NULL, NULL); 216 /*IJGN:*/ &user_inodesize, NULL, NULL, NULL,
217 /*mogL:*/ &reserved_percent, NULL, NULL, &label,
218 /*MOrE:*/ NULL, NULL, NULL, NULL,
219 /*TU:*/ NULL, NULL);
217 argv += optind; // argv[0] -- device 220 argv += optind; // argv[0] -- device
218 221
219 // open the device, check the device is a block device 222 // open the device, check the device is a block device
220 xmove_fd(xopen(argv[0], O_WRONLY), fd); 223 xmove_fd(xopen(argv[0], O_WRONLY), fd);
221 fstat(fd, &st); 224 fstat(fd, &st);
222 if (!S_ISBLK(st.st_mode) && !(option_mask32 & OPT_F)) 225 if (!S_ISBLK(st.st_mode) && !(option_mask32 & OPT_F))
223 bb_error_msg_and_die("not a block device"); 226 bb_error_msg_and_die("%s: not a block device", argv[0]);
224 227
225 // check if it is mounted 228 // check if it is mounted
226 // N.B. what if we format a file? find_mount_point will return false negative since 229 // N.B. what if we format a file? find_mount_point will return false negative since