Merge branch 'master' of git+ssh://vda@busybox.net/var/lib/git/busybox
This commit is contained in:
commit
020465218c
1
.gitignore
vendored
1
.gitignore
vendored
@ -6,6 +6,7 @@
|
||||
*.o.*
|
||||
*.a
|
||||
*.s
|
||||
Kbuild
|
||||
|
||||
#
|
||||
# Never ignore these
|
||||
|
@ -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");
|
||||
};
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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() */
|
||||
|
46
shell/ash.c
46
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
|
||||
|
||||
/*
|
||||
|
1
shell/ash_test/ash-standalone/var_standalone1.right
Normal file
1
shell/ash_test/ash-standalone/var_standalone1.right
Normal file
@ -0,0 +1 @@
|
||||
Done: 1
|
2
shell/ash_test/ash-standalone/var_standalone1.tests
Executable file
2
shell/ash_test/ash-standalone/var_standalone1.tests
Executable file
@ -0,0 +1,2 @@
|
||||
VAR=42 $THIS_SH -c 'unset VAR; env | grep ^VAR'
|
||||
echo Done: $?
|
@ -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" \
|
||||
"\
|
||||
|
@ -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.)
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user