summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko2010-06-19 17:50:44 +0200
committerDenys Vlasenko2010-06-19 17:50:44 +0200
commit020465218ccff1195a47a890037db37d0395c9d9 (patch)
tree491ffc11553f9de9b91c890f82dc0668c44660e8
parente329089c62ed813e97344f8c61d7dc34221fd5ee (diff)
parent8cd9f343e74ca65f36c42a44e845716ba5411663 (diff)
downloadbusybox-020465218ccff1195a47a890037db37d0395c9d9.zip
busybox-020465218ccff1195a47a890037db37d0395c9d9.tar.gz
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 b7840e4..53bd540 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,6 +6,7 @@
*.o.*
*.a
*.s
+Kbuild
#
# Never ignore these
diff --git a/archival/unzip.c b/archival/unzip.c
index 1d3291a..84081c0 100644
--- a/archival/unzip.c
+++ b/archival/unzip.c
@@ -150,23 +150,26 @@ enum { zip_fd = 3 };
#if ENABLE_DESKTOP
+
+#define PEEK_FROM_END 16384
+
/* NB: does not preserve file position! */
static uint32_t find_cdf_offset(void)
{
- unsigned char buf[1024];
cde_header_t cde_header;
unsigned char *p;
off_t end;
+ unsigned char *buf = xzalloc(PEEK_FROM_END);
end = xlseek(zip_fd, 0, SEEK_END);
- end -= 1024;
+ end -= PEEK_FROM_END;
if (end < 0)
end = 0;
xlseek(zip_fd, end, SEEK_SET);
- full_read(zip_fd, buf, 1024);
+ full_read(zip_fd, buf, PEEK_FROM_END);
p = buf;
- while (p <= buf + 1024 - CDE_HEADER_LEN - 4) {
+ while (p <= buf + PEEK_FROM_END - CDE_HEADER_LEN - 4) {
if (*p != 'P') {
p++;
continue;
@@ -180,8 +183,10 @@ static uint32_t find_cdf_offset(void)
/* we found CDE! */
memcpy(cde_header.raw, p + 1, CDE_HEADER_LEN);
FIX_ENDIANNESS_CDE(cde_header);
+ free(buf);
return cde_header.formatted.cdf_offset;
}
+ //free(buf);
bb_error_msg_and_die("can't find file table");
};
diff --git a/e2fsprogs/old_e2fsprogs/e2fsck.c b/e2fsprogs/old_e2fsprogs/e2fsck.c
index 7384bc4..4c4c78d 100644
--- a/e2fsprogs/old_e2fsprogs/e2fsck.c
+++ b/e2fsprogs/old_e2fsprogs/e2fsck.c
@@ -29,10 +29,6 @@
* Licensed under GPLv2 or later, see file License in this tarball for details.
*/
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE 1 /* get strnlen() */
-#endif
-
#include "e2fsck.h" /*Put all of our defines here to clean things up*/
#define _(x) x
diff --git a/libbb/get_line_from_file.c b/libbb/get_line_from_file.c
index 3cb46d2..cbfb45b 100644
--- a/libbb/get_line_from_file.c
+++ b/libbb/get_line_from_file.c
@@ -9,11 +9,6 @@
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
-/* for getline() [GNUism]
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE 1
-#endif
-*/
#include "libbb.h"
/* 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 4718c4d..c734f14 100644
--- a/modutils/depmod.c
+++ b/modutils/depmod.c
@@ -8,8 +8,6 @@
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
-#undef _GNU_SOURCE
-#define _GNU_SOURCE
#include "libbb.h"
#include "modutils.h"
#include <sys/utsname.h> /* uname() */
diff --git a/shell/ash.c b/shell/ash.c
index 90680e8..f581b5b 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -36,16 +36,11 @@
#define JOBS ENABLE_ASH_JOB_CONTROL
-#if DEBUG
-# ifndef _GNU_SOURCE
-# define _GNU_SOURCE
-# endif
-#endif
-
#include "busybox.h" /* for applet_names */
#include <paths.h>
#include <setjmp.h>
#include <fnmatch.h>
+#include <sys/times.h>
#include "shell_common.h"
#include "math.h"
@@ -7251,6 +7246,7 @@ tryexec(IF_FEATURE_SH_STANDALONE(int applet_no,) char *cmd, char **argv, char **
#if ENABLE_FEATURE_SH_STANDALONE
if (applet_no >= 0) {
if (APPLET_IS_NOEXEC(applet_no)) {
+ clearenv();
while (*envp)
putenv(*envp++);
run_applet_no_and_exit(applet_no, argv);
@@ -7310,7 +7306,7 @@ shellexec(char **argv, const char *path, int idx)
#endif
clearredir(/*drop:*/ 1);
- envp = listvars(VEXPORT, VUNSET, 0);
+ envp = listvars(VEXPORT, VUNSET, /*end:*/ NULL);
if (strchr(argv[0], '/') != NULL
#if ENABLE_FEATURE_SH_STANDALONE
|| (applet_no = find_applet_by_name(argv[0])) >= 0
@@ -12468,7 +12464,7 @@ unsetfunc(const char *name)
struct tblentry *cmdp;
cmdp = cmdlookup(name, 0);
- if (cmdp!= NULL && cmdp->cmdtype == CMDFUNCTION)
+ if (cmdp != NULL && cmdp->cmdtype == CMDFUNCTION)
delete_cmd_entry();
}
@@ -12485,7 +12481,7 @@ unsetcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
int flag = 0;
int ret = 0;
- while ((i = nextopt("vf")) != '\0') {
+ while ((i = nextopt("vf")) != 0) {
flag = i;
}
@@ -12502,11 +12498,6 @@ unsetcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
return ret & 1;
}
-
-/* setmode.c */
-
-#include <sys/times.h>
-
static const unsigned char timescmd_str[] ALIGN1 = {
' ', offsetof(struct tms, tms_utime),
'\n', offsetof(struct tms, tms_stime),
@@ -12514,11 +12505,10 @@ static const unsigned char timescmd_str[] ALIGN1 = {
'\n', offsetof(struct tms, tms_cstime),
0
};
-
static int FAST_FUNC
timescmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
{
- long clk_tck, s, t;
+ unsigned long clk_tck, s, t;
const unsigned char *p;
struct tms buf;
@@ -12529,18 +12519,20 @@ timescmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
do {
t = *(clock_t *)(((char *) &buf) + p[1]);
s = t / clk_tck;
- out1fmt("%ldm%ld.%.3lds%c",
- s/60, s%60,
- ((t - s * clk_tck) * 1000) / clk_tck,
+ t = t % clk_tck;
+ out1fmt("%lum%lu.%03lus%c",
+ s / 60, s % 60,
+ (t * 1000) / clk_tck,
p[0]);
- } while (*(p += 2));
+ p += 2;
+ } while (*p);
return 0;
}
#if ENABLE_SH_MATH_SUPPORT
/*
- * The let builtin. partial stolen from GNU Bash, the Bourne Again SHell.
+ * The let builtin. Partially stolen from GNU Bash, the Bourne Again SHell.
* Copyright (C) 1987, 1989, 1991 Free Software Foundation, Inc.
*
* Copyright (C) 2003 Vladimir Oleynik <dzo@simtreas.ru>
@@ -12559,18 +12551,6 @@ letcmd(int argc UNUSED_PARAM, char **argv)
return !i;
}
-#endif /* SH_MATH_SUPPORT */
-
-
-/* ============ miscbltin.c
- *
- * Miscellaneous builtins.
- */
-
-#undef rflag
-
-#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ < 1
-typedef enum __rlimit_resource rlim_t;
#endif
/*
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 0000000..37457fd
--- /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 0000000..1e905ba
--- /dev/null
+++ b/shell/ash_test/ash-standalone/var_standalone1.tests
@@ -0,0 +1,2 @@
+VAR=42 $THIS_SH -c 'unset VAR; env | grep ^VAR'
+echo Done: $?
diff --git a/testsuite/cpio.tests b/testsuite/cpio.tests
index 42e3ff8..5b397b0 100755
--- a/testsuite/cpio.tests
+++ b/testsuite/cpio.tests
@@ -97,14 +97,14 @@ usr
" "" ""
SKIP=
-# chown on a link was affecting file, dropping its sgid bits
+# chown on a link was affecting file, dropping its suid/sgid bits
rm -rf cpio.testdir
optional FEATURE_CPIO_O
mkdir cpio.testdir
touch cpio.testdir/file
-chmod 6755 cpio.testdir/file # set the suid/sgid bit
+chmod 6755 cpio.testdir/file # sets suid/sgid bits
ln -sf file cpio.testdir/link
-testing "cpio restores sgid bits" \
+testing "cpio restores suid/sgid bits" \
"cd cpio.testdir && { echo file; echo link; } | cpio -ovHnewc >pack.cpio && rm ???? && cpio -idmvu <pack.cpio 2>/dev/null;
stat -c '%a %n' file" \
"\
diff --git a/util-linux/Config.src b/util-linux/Config.src
index e971259..3c3e05e 100644
--- a/util-linux/Config.src
+++ b/util-linux/Config.src
@@ -472,7 +472,7 @@ config FEATURE_USE_TERMIOS
config VOLUMEID
bool #No description makes it a hidden option
- default y
+ default n
config FEATURE_VOLUMEID_EXT
bool "Ext filesystem"
@@ -725,7 +725,7 @@ config FEATURE_MOUNT_HELPERS
The idea is to use such virtual filesystems in /etc/fstab.
config FEATURE_MOUNT_LABEL
- bool "Support specifiying devices by label or UUID"
+ bool "Support specifying devices by label or UUID"
default y
depends on MOUNT
select VOLUMEID
@@ -930,7 +930,7 @@ config FEATURE_MTAB_SUPPORT
If you must use this, keep in mind it's inherently brittle (for
example a mount under chroot won't update it), can't handle modern
features like separate per-process filesystem namespaces, requires
- that your /etc directory be writeable, tends to get easily confused
+ that your /etc directory be writable, tends to get easily confused
by --bind or --move mounts, won't update if you rename a directory
that contains a mount point, and so on. (In brief: avoid.)
diff --git a/util-linux/hwclock.c b/util-linux/hwclock.c
index 416271b..3da2e23 100644
--- a/util-linux/hwclock.c
+++ b/util-linux/hwclock.c
@@ -12,13 +12,6 @@
#include <sys/utsname.h>
#include "rtc_.h"
-#if ENABLE_FEATURE_HWCLOCK_LONG_OPTIONS
-# ifndef _GNU_SOURCE
-# define _GNU_SOURCE
-# endif
-#endif
-
-
/* diff code is disabled: it's not sys/hw clock diff, it's some useless
* "time between hwclock was started and we saw CMOS tick" quantity.
* 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 fd54734..14feb92 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)
// only for directories, which never need i_size_high).
//
// Standard mke2fs creates a filesystem with 256-byte inodes if it is
-// bigger than 0.5GB. So far, we do not do this.
+// bigger than 0.5GB.
// Standard mke2fs 1.41.9:
// 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)
// using global "option_mask32" instead of local "opts":
// we are register starved here
- opt_complementary = "-1:b+:m+:i+";
+ opt_complementary = "-1:b+:i+:I+:m+";
/*opts =*/ getopt32(argv, "cl:b:f:i:I:J:G:N:m:o:g:L:M:O:r:E:T:U:jnqvFS",
- NULL, &bs, NULL, &bpi, &user_inodesize, NULL, NULL, NULL,
- &reserved_percent, NULL, NULL, &label, NULL, NULL, NULL, NULL, NULL, NULL);
+ /*lbfi:*/ NULL, &bs, NULL, &bpi,
+ /*IJGN:*/ &user_inodesize, NULL, NULL, NULL,
+ /*mogL:*/ &reserved_percent, NULL, NULL, &label,
+ /*MOrE:*/ NULL, NULL, NULL, NULL,
+ /*TU:*/ NULL, NULL);
argv += optind; // argv[0] -- device
// open the device, check the device is a block device
xmove_fd(xopen(argv[0], O_WRONLY), fd);
fstat(fd, &st);
if (!S_ISBLK(st.st_mode) && !(option_mask32 & OPT_F))
- bb_error_msg_and_die("not a block device");
+ bb_error_msg_and_die("%s: not a block device", argv[0]);
// check if it is mounted
// N.B. what if we format a file? find_mount_point will return false negative since