Vodz' last_patch31
Very minimal last corrections: 1) busybox.c: fix warining 2) docs/: add applets for list from pwd_grp 3) usage.h: add -n option for route 4) run_parts.c: many todo fix for busybox style 5) addgroup.c: add #ifdef CONFIG_FEATURE_SHADOWPASSWDS, reduce one perror_msg 6) adduser.c: fix bug "variable i not initialize" and add #ifdef CONFIG_FEATURE_SHADOWPASSWDS
This commit is contained in:
parent
f3f9062ecf
commit
fb74a45088
@ -35,7 +35,7 @@ typedef int (*__link_f)(const char *, const char *);
|
|||||||
* malloc'd string w/ full pathname of busybox's location
|
* malloc'd string w/ full pathname of busybox's location
|
||||||
* NULL on failure
|
* NULL on failure
|
||||||
*/
|
*/
|
||||||
static char *busybox_fullpath()
|
static char *busybox_fullpath(void)
|
||||||
{
|
{
|
||||||
return xreadlink("/proc/self/exe");
|
return xreadlink("/proc/self/exe");
|
||||||
}
|
}
|
||||||
|
@ -136,19 +136,23 @@
|
|||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
ar, basename, cat, chgrp, chmod, chown, chroot, chvt, clear,
|
addgroup, adduser, adjtimex, ar, basename, busybox, cat,
|
||||||
cp, cut, date, dc, dd, deallocvt, df, dirname, dmesg, dpkg-deb,
|
chgrp, chmod, chown, chroot, chvt, clear, cmp, cp, cpio, cut,
|
||||||
du, dumpkmap, dutmp, echo, false, fbset, fdflush, find, free,
|
date, dc, dd, deallocvt, deluser, df, dirname, dmesg,
|
||||||
freeramdisk, fsck.minix, grep, gunzip, gzip, halt, head,
|
dos2unix, dpkg, dpkg-deb, du, dumpkmap, dutmp, echo, expr,
|
||||||
hostid, hostname, id, init, insmod, kill, killall, length, ln,
|
false, fbset, fdflush, find, free, freeramdisk, fsck.minix,
|
||||||
loadacm, loadfont, loadkmap, logger, logname, ls, lsmod,
|
getopt, getty, grep, gunzip, gzip, halt, head, hostid,
|
||||||
makedevs, mkdir, mkfifo, mkfs.minix, mknod, mkswap, mktemp,
|
hostname, id, ifconfig, init, insmod, kill, killall, klogd,
|
||||||
more, mount, mt, mv, nc, nslookup, ping, poweroff, printf, ps,
|
length, ln, loadacm, loadfont, loadkmap, logger, logname, ls,
|
||||||
pwd, reboot, renice, reset, rm, rmdir, rmmod, run-parts, sed, setkeycodes, sh, sleep,
|
lsmod, makedevs, md5sum, mkdir, mkfifo, mkfs.minix, mknod,
|
||||||
sort, swapoff, swapon, sync, syslogd, tail, tar, tee, telnet,
|
mkswap, mktemp, more, mount, mt, mv, nc, nslookup, ping,
|
||||||
test, touch, tr, true, tty, umount, uname, uniq, update,
|
pivot_root, poweroff, printf, ps, pwd, rdate, readlink,
|
||||||
uptime, usleep, uudecode, uuencode, wc, which, whoami, yes,
|
reboot, renice, reset, rm, rmdir, rmmod, route, rpm2cpio,
|
||||||
zcat, [
|
sed, setkeycodes, sh, sleep, sort, stty, swapoff, swapon,
|
||||||
|
sync, syslogd, tail, tar, tee, telnet, test, tftp, touch, tr,
|
||||||
|
true, tty, umount, uname, uniq, unix2dos, update, uptime,
|
||||||
|
usleep, uudecode, uuencode, watchdog, wc, wget, which,
|
||||||
|
whoami, xargs, yes, zcat, [
|
||||||
</para>
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
@ -3996,6 +4000,10 @@
|
|||||||
Enrique Zanardi <ezanardi@ull.es>
|
Enrique Zanardi <ezanardi@ull.es>
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
Vladimir Oleynik <dzo@simtreas.ru>
|
||||||
|
</para>
|
||||||
|
|
||||||
|
|
||||||
</chapter>
|
</chapter>
|
||||||
</book> <!-- End of the book -->
|
</book> <!-- End of the book -->
|
||||||
|
@ -113,7 +113,7 @@ Glenn McGrath <bug1@netconnect.com.au>
|
|||||||
|
|
||||||
Vladimir Oleynik <dzo@simtreas.ru>
|
Vladimir Oleynik <dzo@simtreas.ru>
|
||||||
|
|
||||||
cmdedit, stty-port, locale, various fixes
|
cmdedit; ports: ash, stty, traceroute; locale, various fixes
|
||||||
and irreconcilable critic of everything not perfect.
|
and irreconcilable critic of everything not perfect.
|
||||||
|
|
||||||
=for html <br>
|
=for html <br>
|
||||||
@ -166,4 +166,4 @@ Enrique Zanardi <ezanardi@ull.es>
|
|||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
# $Id: busybox_footer.pod,v 1.4 2001/04/17 17:09:34 beppu Exp $
|
# $Id: busybox_footer.pod,v 1.5 2001/12/18 14:06:01 andersen Exp $
|
||||||
|
@ -55,19 +55,20 @@ terse runtime description of their behavior.
|
|||||||
|
|
||||||
Currently defined functions include:
|
Currently defined functions include:
|
||||||
|
|
||||||
adjtimex, ar, basename, busybox, cat, chgrp, chmod, chown, chroot, chvt, clear,
|
addgroup, adduser, adjtimex, ar, basename, busybox, cat, chgrp, chmod,
|
||||||
cmp, cp, cpio, cut, date, dc, dd, deallocvt, df, dirname, dmesg, dos2unix, dpkg,
|
chown, chroot, chvt, clear, cmp, cp, cpio, cut, date, dc, dd, deallocvt,
|
||||||
dpkg-deb, du, dumpkmap, dutmp, echo, expr, false, fbset, fdflush, find, free,
|
deluser, df, dirname, dmesg, dos2unix, dpkg, dpkg-deb, du, dumpkmap, dutmp,
|
||||||
freeramdisk, fsck.minix, getopt, grep, gunzip, gzip, halt, head, hostid,
|
echo, expr, false, fbset, fdflush, find, free, freeramdisk, fsck.minix,
|
||||||
hostname, id, ifconfig, init, insmod, kill, killall, klogd, length, ln,
|
getopt, getty, grep, gunzip, gzip, halt, head, hostid, hostname, id,
|
||||||
loadacm, loadfont, loadkmap, logger, logname, ls, lsmod, makedevs, md5sum,
|
ifconfig, init, insmod, kill, killall, klogd, length, ln, loadacm,
|
||||||
mkdir, mkfifo, mkfs.minix, mknod, mkswap, mktemp, more, mount, mt, mv, nc,
|
loadfont, loadkmap, logger, logname, ls, lsmod, makedevs, md5sum, mkdir,
|
||||||
nslookup, ping, pivot_root, poweroff, printf, ps, pwd, rdate, readlink, reboot,
|
mkfifo, mkfs.minix, mknod, mkswap, mktemp, more, mount, mt, mv, nc,
|
||||||
renice, reset, rm, rmdir, rmmod, route, rpm2cpio, sed, setkeycodes,
|
nslookup, ping, pivot_root, poweroff, printf, ps, pwd, rdate, readlink,
|
||||||
sh, sleep, sort, stty, swapoff, swapon, sync, syslogd, tail, tar, tee, telnet,
|
reboot, renice, reset, rm, rmdir, rmmod, route, rpm2cpio, sed, setkeycodes,
|
||||||
test, tftp, touch, tr, true, tty, umount, uname, uniq, unix2dos, update, uptime,
|
sh, sleep, sort, stty, swapoff, swapon, sync, syslogd, tail, tar, tee,
|
||||||
usleep, uudecode, uuencode, watchdog, wc, wget, which, whoami, xargs, yes, zcat,
|
telnet, test, tftp, touch, tr, true, tty, umount, uname, uniq, unix2dos,
|
||||||
[
|
update, uptime, usleep, uudecode, uuencode, watchdog, wc, wget, which,
|
||||||
|
whoami, xargs, yes, zcat, [
|
||||||
|
|
||||||
=over 4
|
=over 4
|
||||||
|
|
||||||
|
@ -1432,6 +1432,8 @@
|
|||||||
"[{add|del|flush}]"
|
"[{add|del|flush}]"
|
||||||
#define route_full_usage \
|
#define route_full_usage \
|
||||||
"Edit the kernel's routing tables"
|
"Edit the kernel's routing tables"
|
||||||
|
"Options:\n" \
|
||||||
|
"\t-n\tDont resolve names."
|
||||||
|
|
||||||
#define rpm2cpio_trivial_usage \
|
#define rpm2cpio_trivial_usage \
|
||||||
"package.rpm"
|
"package.rpm"
|
||||||
|
@ -45,9 +45,9 @@
|
|||||||
* done - convert calls to error in perror... and remove error()
|
* done - convert calls to error in perror... and remove error()
|
||||||
* done - convert malloc/realloc to their x... counterparts
|
* done - convert malloc/realloc to their x... counterparts
|
||||||
* done - remove catch_sigchld
|
* done - remove catch_sigchld
|
||||||
* use bb's isdirectory() ? It seems that no applet use it.
|
|
||||||
* done - use bb's concat_path_file()
|
* done - use bb's concat_path_file()
|
||||||
* declare run_parts_main() as extern and any other function as static? */
|
* done - declare run_parts_main() as extern and any other function as static?
|
||||||
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
@ -61,17 +61,14 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
/* #include <signal.h>
|
|
||||||
#include <sys/time.h> */
|
|
||||||
|
|
||||||
#include "busybox.h"
|
#include "busybox.h"
|
||||||
|
|
||||||
int test_mode = 0;
|
static int test_mode = 0;
|
||||||
int verbose_mode = 0;
|
static int exitstatus = 0;
|
||||||
int exitstatus = 0;
|
|
||||||
|
|
||||||
int argcount = 0, argsize = 0;
|
static int argcount = 0, argsize = 0;
|
||||||
char **args = 0;
|
static char **args = 0;
|
||||||
|
|
||||||
|
|
||||||
/* set_umask */
|
/* set_umask */
|
||||||
@ -80,7 +77,7 @@ char **args = 0;
|
|||||||
* 8 and 9 digits under some circumstances. We'll just have to live with it.
|
* 8 and 9 digits under some circumstances. We'll just have to live with it.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void set_umask (void)
|
static void set_umask (void)
|
||||||
{
|
{
|
||||||
int mask, result;
|
int mask, result;
|
||||||
|
|
||||||
@ -97,14 +94,14 @@ void set_umask (void)
|
|||||||
/* add_argument */
|
/* add_argument */
|
||||||
/* Add an argument to the commands that we will call. Called once for
|
/* Add an argument to the commands that we will call. Called once for
|
||||||
every argument. */
|
every argument. */
|
||||||
void add_argument (char *newarg)
|
static void add_argument (char *newarg)
|
||||||
{
|
{
|
||||||
if (argcount+1 >= argsize) {
|
if (argcount+1 >= argsize) {
|
||||||
argsize = argsize ? argsize*2 : 4;
|
argsize = argsize ? argsize*2 : 4;
|
||||||
/*TODO if we convert to xrealloc we lose the verbose error message */
|
/*TODO if we convert to xrealloc we lose the verbose error message */
|
||||||
args = realloc(args, argsize * (sizeof(char*)));
|
args = realloc(args, argsize * (sizeof(char*)));
|
||||||
if (!args) {
|
if (!args) {
|
||||||
perror_msg_and_die ("failed to reallocate memory for arguments: %s", strerror(errno));
|
perror_msg_and_die ("failed to reallocate memory for arguments");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
args[argcount++] = newarg;
|
args[argcount++] = newarg;
|
||||||
@ -116,7 +113,7 @@ void add_argument (char *newarg)
|
|||||||
* underscores, and hyphens only?)
|
* underscores, and hyphens only?)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int valid_name (const struct dirent *d)
|
static int valid_name (const struct dirent *d)
|
||||||
{
|
{
|
||||||
char *c = d->d_name;
|
char *c = d->d_name;
|
||||||
while (*c) {
|
while (*c) {
|
||||||
@ -132,19 +129,19 @@ int valid_name (const struct dirent *d)
|
|||||||
/* run_part */
|
/* run_part */
|
||||||
/* Execute a file */
|
/* Execute a file */
|
||||||
|
|
||||||
void run_part (char *progname)
|
static void run_part (char *progname)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
int pid;
|
int pid;
|
||||||
|
|
||||||
|
|
||||||
if ((pid=fork()) < 0) {
|
if ((pid=fork()) < 0) {
|
||||||
perror_msg_and_die ("failed to fork: %s", strerror(errno));
|
perror_msg_and_die ("failed to fork");
|
||||||
}
|
}
|
||||||
else if (!pid) {
|
else if (!pid) {
|
||||||
args[0] = progname;
|
args[0] = progname;
|
||||||
execv (progname, args);
|
execv (progname, args);
|
||||||
perror_msg_and_die ("failed to exec %s: %s", progname, strerror (errno));
|
perror_msg_and_die ("failed to exec %s", progname);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0) {
|
if (0) {
|
||||||
@ -168,70 +165,30 @@ void run_part (char *progname)
|
|||||||
/* run_parts */
|
/* run_parts */
|
||||||
/* Find the parts to run & call run_part() */
|
/* Find the parts to run & call run_part() */
|
||||||
|
|
||||||
void run_parts (char *dir_name)
|
static void run_parts (char *dir_name)
|
||||||
{
|
{
|
||||||
struct dirent **namelist;
|
struct dirent **namelist = 0;
|
||||||
char *filename = NULL;
|
char *filename;
|
||||||
size_t filename_length, dir_name_length;
|
int entries, i;
|
||||||
int entries, i, result;
|
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
/* dir_name + "/" */
|
|
||||||
dir_name_length = strlen(dir_name) + 1;
|
|
||||||
|
|
||||||
/* dir_name + "/" + ".." + "\0" (This will save one realloc.) */
|
|
||||||
filename_length = dir_name_length + 2 + 1;
|
|
||||||
|
|
||||||
/* --
|
|
||||||
* Removed this part because I want try to use concat_path_file() */
|
|
||||||
|
|
||||||
/* if (! (filename = malloc(filename_length))) {
|
|
||||||
error ("failed to allocate memory for path: %s", strerror(errno));
|
|
||||||
exit (1);
|
|
||||||
} */
|
|
||||||
|
|
||||||
/* -- */
|
/* -- */
|
||||||
|
|
||||||
/* scandir() isn't POSIX, but it makes things easy. */
|
/* scandir() isn't POSIX, but it makes things easy. */
|
||||||
entries = scandir (dir_name, &namelist, valid_name, alphasort);
|
entries = scandir (dir_name, &namelist, valid_name, alphasort);
|
||||||
|
|
||||||
if (entries < 0) {
|
if (entries < 0) {
|
||||||
perror_msg_and_die ("failed to open directory %s: %s", dir_name, strerror (errno));
|
perror_msg_and_die ("failed to open directory %s", dir_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < entries; i++) {
|
for (i = 0; i < entries; i++) {
|
||||||
|
|
||||||
/* --
|
|
||||||
* Removed this part because I want try to use concat_path_file() */
|
|
||||||
|
|
||||||
/* if (filename_length < dir_name_length + strlen(namelist[i]->d_name) + 1) {
|
|
||||||
filename_length = dir_name_length + strlen(namelist[i]->d_name) + 1;
|
|
||||||
if (!(filename = realloc(filename, filename_length))) {
|
|
||||||
error ("failed to reallocate memory for path: %s", strerror(errno));
|
|
||||||
exit (1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* -- */
|
|
||||||
|
|
||||||
|
|
||||||
/* --
|
|
||||||
* Removed for concat_path_file() */
|
|
||||||
|
|
||||||
/* strcpy (filename, dir_name);
|
|
||||||
strcat (filename, "/");
|
|
||||||
strcat (filename, namelist[i]->d_name); */
|
|
||||||
|
|
||||||
/* -- */
|
/* -- */
|
||||||
|
|
||||||
filename = concat_path_file (dir_name, namelist[i]->d_name);
|
filename = concat_path_file (dir_name, namelist[i]->d_name);
|
||||||
|
|
||||||
result = stat (filename, &st);
|
if (stat (filename, &st) < 0) {
|
||||||
if (result < 0) {
|
perror_msg_and_die ("failed to stat component %s", filename);
|
||||||
perror_msg_and_die ("failed to stat component %s: %s", filename,
|
|
||||||
strerror (errno));
|
|
||||||
}
|
}
|
||||||
if (S_ISREG(st.st_mode) && !access (filename, X_OK)) {
|
if (S_ISREG(st.st_mode) && !access (filename, X_OK)) {
|
||||||
if (test_mode)
|
if (test_mode)
|
||||||
@ -240,17 +197,17 @@ void run_parts (char *dir_name)
|
|||||||
run_part (filename);
|
run_part (filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*TODO convert to isdirectory() */
|
|
||||||
else if (!S_ISDIR(st.st_mode)) {
|
else if (!S_ISDIR(st.st_mode)) {
|
||||||
printf ("run-parts: component %s is not an executable plain file\n",
|
error_msg ("component %s is not an executable plain file",
|
||||||
filename);
|
filename);
|
||||||
exitstatus = 1;
|
exitstatus = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
free (namelist[i]);
|
free (namelist[i]);
|
||||||
|
free (filename);
|
||||||
}
|
}
|
||||||
free (namelist);
|
free (namelist);
|
||||||
free (filename);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* run_parts_main */
|
/* run_parts_main */
|
||||||
|
Loading…
Reference in New Issue
Block a user