mirror of
https://github.com/sheumann/hush.git
synced 2025-01-13 06:30:09 +00:00
Some adjustments, mostly from David McCullough <davidm@lineo.com> to
make busybox be more uClinux friendly. I also adjusted Config.h for uClinux so it will automagically disable apps the arn't going to work without fork() and such. -Erik
This commit is contained in:
parent
0382eb8865
commit
20aab260e2
13
Config.h
13
Config.h
@ -417,6 +417,19 @@
|
|||||||
// Nothing beyond this point should ever be touched by
|
// Nothing beyond this point should ever be touched by
|
||||||
// mere mortals so leave this stuff alone.
|
// mere mortals so leave this stuff alone.
|
||||||
//
|
//
|
||||||
|
#include <features.h>
|
||||||
|
#if defined __UCLIBC__ && ! defined __UCLIBC_HAS_MMU__
|
||||||
|
#undef BB_RPM2CPIO /* Uses gz_open(), which uses fork() */
|
||||||
|
#undef BB_DPKG_DEB /* Uses gz_open(), which uses fork() */
|
||||||
|
#undef BB_FEATURE_ASH /* Uses fork() */
|
||||||
|
#undef BB_FEATURE_HUSH /* Uses fork() */
|
||||||
|
#undef BB_FEATURE_LASH /* Uses fork() */
|
||||||
|
#undef BB_INIT /* Uses fork() */
|
||||||
|
#undef BB_FEATURE_TAR_GZIP /* Uses fork() */
|
||||||
|
#undef BB_SYSLOGD /* Uses daemon() */
|
||||||
|
#undef BB_KLOGD /* Uses daemon() */
|
||||||
|
#undef BB_UPDATE /* Uses daemon() */
|
||||||
|
#endif
|
||||||
#if defined BB_SH
|
#if defined BB_SH
|
||||||
#if defined BB_FEATURE_COMMAND_EDITING
|
#if defined BB_FEATURE_COMMAND_EDITING
|
||||||
#define BB_CMDEDIT
|
#define BB_CMDEDIT
|
||||||
|
2
Makefile
2
Makefile
@ -396,7 +396,7 @@ clean:
|
|||||||
docs/busybox.lineo.com/BusyBox.html
|
docs/busybox.lineo.com/BusyBox.html
|
||||||
- rm -f docs/busybox.txt docs/busybox.dvi docs/busybox.ps \
|
- rm -f docs/busybox.txt docs/busybox.dvi docs/busybox.ps \
|
||||||
docs/busybox.pdf docs/busybox.lineo.com/busybox.html
|
docs/busybox.pdf docs/busybox.lineo.com/busybox.html
|
||||||
- rm -f multibuild.log Config.h.orig
|
- rm -f multibuild.log Config.h.orig *.gdb *.elf
|
||||||
- rm -rf docs/busybox _install libpwd.a libbb.a pod2htm*
|
- rm -rf docs/busybox _install libpwd.a libbb.a pod2htm*
|
||||||
- rm -f busybox.links libbb/loop.h *~ slist.mk core applet_source_list
|
- rm -f busybox.links libbb/loop.h *~ slist.mk core applet_source_list
|
||||||
- find -name \*.o -exec rm -f {} \;
|
- find -name \*.o -exec rm -f {} \;
|
||||||
|
@ -303,6 +303,7 @@ static struct dnode **dnalloc(int num)
|
|||||||
return(p);
|
return(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef BB_FEATURE_LS_RECURSIVE
|
||||||
static void dfree(struct dnode **dnp)
|
static void dfree(struct dnode **dnp)
|
||||||
{
|
{
|
||||||
struct dnode *cur, *next;
|
struct dnode *cur, *next;
|
||||||
@ -318,6 +319,7 @@ static void dfree(struct dnode **dnp)
|
|||||||
}
|
}
|
||||||
free(dnp); /* free the array holding the dnode pointers */
|
free(dnp); /* free the array holding the dnode pointers */
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static struct dnode **splitdnarray(struct dnode **dn, int nfiles, int which)
|
static struct dnode **splitdnarray(struct dnode **dn, int nfiles, int which)
|
||||||
{
|
{
|
||||||
|
@ -207,6 +207,8 @@ static int decode (const char *inname,
|
|||||||
char buf[2 * BUFSIZ];
|
char buf[2 * BUFSIZ];
|
||||||
char *outname;
|
char *outname;
|
||||||
int do_base64 = 0;
|
int do_base64 = 0;
|
||||||
|
int res;
|
||||||
|
int dofre;
|
||||||
|
|
||||||
/* Search for header line. */
|
/* Search for header line. */
|
||||||
|
|
||||||
@ -226,6 +228,7 @@ static int decode (const char *inname,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* If the output file name is given on the command line this rules. */
|
/* If the output file name is given on the command line this rules. */
|
||||||
|
dofre = FALSE;
|
||||||
if (forced_outname != NULL)
|
if (forced_outname != NULL)
|
||||||
outname = (char *) forced_outname;
|
outname = (char *) forced_outname;
|
||||||
else {
|
else {
|
||||||
@ -248,10 +251,11 @@ static int decode (const char *inname,
|
|||||||
}
|
}
|
||||||
n = strlen (pw->pw_dir);
|
n = strlen (pw->pw_dir);
|
||||||
n1 = strlen (p);
|
n1 = strlen (p);
|
||||||
outname = (char *) alloca ((size_t) (n + n1 + 2));
|
outname = (char *) xmalloc ((size_t) (n + n1 + 2));
|
||||||
memcpy (outname + n + 1, p, (size_t) (n1 + 1));
|
memcpy (outname + n + 1, p, (size_t) (n1 + 1));
|
||||||
memcpy (outname, pw->pw_dir, (size_t) n);
|
memcpy (outname, pw->pw_dir, (size_t) n);
|
||||||
outname[n] = '/';
|
outname[n] = '/';
|
||||||
|
dofre = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,6 +265,8 @@ static int decode (const char *inname,
|
|||||||
|| chmod (outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO))
|
|| chmod (outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO))
|
||||||
)) {
|
)) {
|
||||||
perror_msg("%s", outname); /* */
|
perror_msg("%s", outname); /* */
|
||||||
|
if (dofre)
|
||||||
|
free(outname);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -269,9 +275,12 @@ static int decode (const char *inname,
|
|||||||
|
|
||||||
/* For each input line: */
|
/* For each input line: */
|
||||||
if (do_base64)
|
if (do_base64)
|
||||||
return read_base64 (inname);
|
res = read_base64 (inname);
|
||||||
else
|
else
|
||||||
return read_stduu (inname);
|
res = read_stduu (inname);
|
||||||
|
if (dofre)
|
||||||
|
free(outname);
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
int uudecode_main (int argc,
|
int uudecode_main (int argc,
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static const char vi_Version[] =
|
static const char vi_Version[] =
|
||||||
"$Id: vi.c,v 1.12 2001/07/17 01:12:36 andersen Exp $";
|
"$Id: vi.c,v 1.13 2001/07/19 22:28:01 andersen Exp $";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* To compile for standalone use:
|
* To compile for standalone use:
|
||||||
@ -3554,7 +3554,7 @@ static int file_write(Byte * fn, Byte * first, Byte * last)
|
|||||||
}
|
}
|
||||||
charcnt = 0;
|
charcnt = 0;
|
||||||
// FIXIT- use the correct umask()
|
// FIXIT- use the correct umask()
|
||||||
fd = open((char *) fn, (O_RDWR | O_CREAT | O_TRUNC), 0664);
|
fd = open((char *) fn, (O_WRONLY | O_CREAT | O_TRUNC), 0664);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return (-1);
|
return (-1);
|
||||||
cnt = last - first + 1;
|
cnt = last - first + 1;
|
||||||
|
5
kill.c
5
kill.c
@ -147,9 +147,8 @@ extern int kill_main(int argc, char **argv)
|
|||||||
const struct signal_name *s = signames;
|
const struct signal_name *s = signames;
|
||||||
|
|
||||||
while (s->name != 0) {
|
while (s->name != 0) {
|
||||||
col +=
|
col += fprintf(stderr, "%2d) %-8s", s->number, s->name);
|
||||||
fprintf(stderr, "%2d) %-8s", s->number,
|
s++;
|
||||||
(s++)->name);
|
|
||||||
if (col > 60) {
|
if (col > 60) {
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
col = 0;
|
col = 0;
|
||||||
|
@ -15,7 +15,7 @@ extern FILE *gz_open(FILE *compressed_file, int *pid)
|
|||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
if ((*pid = fork()) == -1) {
|
if ((*pid = fork()) == -1) {
|
||||||
error_msg("fork failured");
|
error_msg("fork failed");
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
if (*pid==0) {
|
if (*pid==0) {
|
||||||
@ -29,7 +29,7 @@ extern FILE *gz_open(FILE *compressed_file, int *pid)
|
|||||||
}
|
}
|
||||||
close(unzip_pipe[1]);
|
close(unzip_pipe[1]);
|
||||||
if (unzip_pipe[0] == -1) {
|
if (unzip_pipe[0] == -1) {
|
||||||
error_msg("Couldnt initialise gzip stream");
|
error_msg("gzip stream init failed");
|
||||||
}
|
}
|
||||||
return(fdopen(unzip_pipe[0], "r"));
|
return(fdopen(unzip_pipe[0], "r"));
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* that either displays or sets the characteristics of
|
* that either displays or sets the characteristics of
|
||||||
* one or more of the system's networking interfaces.
|
* one or more of the system's networking interfaces.
|
||||||
*
|
*
|
||||||
* Version: $Id: interface.c,v 1.3 2001/06/01 21:47:15 andersen Exp $
|
* Version: $Id: interface.c,v 1.4 2001/07/19 22:28:02 andersen Exp $
|
||||||
*
|
*
|
||||||
* Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
|
* Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
|
||||||
* and others. Copyright 1993 MicroWalt Corporation
|
* and others. Copyright 1993 MicroWalt Corporation
|
||||||
@ -78,7 +78,9 @@
|
|||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
#if 0
|
||||||
#include <arpa/nameser.h>
|
#include <arpa/nameser.h>
|
||||||
|
#endif
|
||||||
#include "libbb.h"
|
#include "libbb.h"
|
||||||
|
|
||||||
#define _(x) x
|
#define _(x) x
|
||||||
@ -455,9 +457,11 @@ static int INET_rresolve(char *name, size_t len, struct sockaddr_in *s_in,
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf (stderr, "getnetbyaddr (%08lx)\n", host_ad);
|
fprintf (stderr, "getnetbyaddr (%08lx)\n", host_ad);
|
||||||
#endif
|
#endif
|
||||||
|
#if 0
|
||||||
np = getnetbyaddr(host_ad, AF_INET);
|
np = getnetbyaddr(host_ad, AF_INET);
|
||||||
if (np != NULL)
|
if (np != NULL)
|
||||||
safe_strncpy(name, np->n_name, len);
|
safe_strncpy(name, np->n_name, len);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
if ((ent == NULL) && (np == NULL))
|
if ((ent == NULL) && (np == NULL))
|
||||||
safe_strncpy(name, inet_ntoa(s_in->sin_addr), len);
|
safe_strncpy(name, inet_ntoa(s_in->sin_addr), len);
|
||||||
@ -1068,7 +1072,6 @@ static int if_readconf(void)
|
|||||||
struct ifconf ifc;
|
struct ifconf ifc;
|
||||||
struct ifreq *ifr;
|
struct ifreq *ifr;
|
||||||
int n, err = -1;
|
int n, err = -1;
|
||||||
/* XXX Should this re-use the global skfd? */
|
|
||||||
int skfd2;
|
int skfd2;
|
||||||
|
|
||||||
/* SIOCGIFCONF currently seems to only work properly on AF_INET sockets
|
/* SIOCGIFCONF currently seems to only work properly on AF_INET sockets
|
||||||
|
26
logger.c
26
logger.c
@ -127,14 +127,20 @@ extern int logger_main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
openlog(name, option, (pri | LOG_FACMASK));
|
||||||
if (optind == argc) {
|
if (optind == argc) {
|
||||||
/* read from stdin */
|
do {
|
||||||
i = 0;
|
/* read from stdin */
|
||||||
while ((c = getc(stdin)) != EOF && i < sizeof(buf)) {
|
i = 0;
|
||||||
buf[i++] = c;
|
while ((c = getc(stdin)) != EOF && c != '\n' &&
|
||||||
}
|
i < (sizeof(buf)-1)) {
|
||||||
buf[i++] = '\0';
|
buf[i++] = c;
|
||||||
message = buf;
|
}
|
||||||
|
if (i > 0) {
|
||||||
|
buf[i++] = '\0';
|
||||||
|
syslog(pri, "%s", buf);
|
||||||
|
}
|
||||||
|
} while (c != EOF);
|
||||||
} else {
|
} else {
|
||||||
len = 1; /* for the '\0' */
|
len = 1; /* for the '\0' */
|
||||||
message=xcalloc(1, 1);
|
message=xcalloc(1, 1);
|
||||||
@ -146,12 +152,10 @@ extern int logger_main(int argc, char **argv)
|
|||||||
strcat(message, " ");
|
strcat(message, " ");
|
||||||
}
|
}
|
||||||
message[strlen(message)-1] = '\0';
|
message[strlen(message)-1] = '\0';
|
||||||
|
syslog(pri, "%s", message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*openlog(name, option, (pri | LOG_FACMASK));
|
closelog();
|
||||||
syslog(pri, "%s", message);
|
|
||||||
closelog();*/
|
|
||||||
syslog_msg_with_name(name,(pri | LOG_FACMASK),pri,message);
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
ls.c
2
ls.c
@ -303,6 +303,7 @@ static struct dnode **dnalloc(int num)
|
|||||||
return(p);
|
return(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef BB_FEATURE_LS_RECURSIVE
|
||||||
static void dfree(struct dnode **dnp)
|
static void dfree(struct dnode **dnp)
|
||||||
{
|
{
|
||||||
struct dnode *cur, *next;
|
struct dnode *cur, *next;
|
||||||
@ -318,6 +319,7 @@ static void dfree(struct dnode **dnp)
|
|||||||
}
|
}
|
||||||
free(dnp); /* free the array holding the dnode pointers */
|
free(dnp); /* free the array holding the dnode pointers */
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static struct dnode **splitdnarray(struct dnode **dn, int nfiles, int which)
|
static struct dnode **splitdnarray(struct dnode **dn, int nfiles, int which)
|
||||||
{
|
{
|
||||||
|
@ -65,46 +65,44 @@ extern int update_main(int argc, char **argv)
|
|||||||
show_usage();
|
show_usage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (daemon(0, 1) < 0)
|
||||||
|
perror_msg_and_die("daemon");
|
||||||
|
|
||||||
pid = fork();
|
/* Become a proper daemon */
|
||||||
if (pid < 0)
|
setsid();
|
||||||
return EXIT_FAILURE;
|
chdir("/");
|
||||||
else if (pid == 0) {
|
|
||||||
/* Become a proper daemon */
|
|
||||||
setsid();
|
|
||||||
chdir("/");
|
|
||||||
#ifdef OPEN_MAX
|
#ifdef OPEN_MAX
|
||||||
for (pid = 0; pid < OPEN_MAX; pid++) close(pid);
|
for (pid = 0; pid < OPEN_MAX; pid++) close(pid);
|
||||||
#else
|
#else
|
||||||
/* glibc 2.1.92 requires using sysconf(_SC_OPEN_MAX) */
|
/* glibc 2.1.92 requires using sysconf(_SC_OPEN_MAX) */
|
||||||
for (pid = 0; pid < sysconf(_SC_OPEN_MAX); pid++) close(pid);
|
for (pid = 0; pid < sysconf(_SC_OPEN_MAX); pid++) close(pid);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/* This is no longer necessary since 1.3.5x, but it will harmlessly
|
||||||
* This is no longer necessary since 1.3.5x, but it will harmlessly
|
* exit if that is the case.
|
||||||
* exit if that is the case.
|
*/
|
||||||
*/
|
|
||||||
|
|
||||||
/* set the program name that will show up in a 'ps' listing */
|
/* set the program name that will show up in a 'ps' listing */
|
||||||
argv[0] = "bdflush (update)";
|
argv[0] = "bdflush (update)";
|
||||||
argv[1] = NULL;
|
argv[1] = NULL;
|
||||||
argv[2] = NULL;
|
argv[2] = NULL;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (use_sync) {
|
if (use_sync) {
|
||||||
sleep(sync_duration);
|
sleep(sync_duration);
|
||||||
sync();
|
sync();
|
||||||
} else {
|
} else {
|
||||||
sleep(flush_duration);
|
sleep(flush_duration);
|
||||||
if (bdflush(1, 0) < 0) {
|
if (bdflush(1, 0) < 0) {
|
||||||
openlog("update", LOG_CONS, LOG_DAEMON);
|
openlog("update", LOG_CONS, LOG_DAEMON);
|
||||||
syslog(LOG_INFO,
|
syslog(LOG_INFO,
|
||||||
"This kernel does not need update(8). Exiting.");
|
"This kernel does not need update(8). Exiting.");
|
||||||
closelog();
|
closelog();
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,12 +56,12 @@ static void parse_url(char *url, struct host_info *h);
|
|||||||
static FILE *open_socket(char *host, int port);
|
static FILE *open_socket(char *host, int port);
|
||||||
static char *gethdr(char *buf, size_t bufsiz, FILE *fp, int *istrunc);
|
static char *gethdr(char *buf, size_t bufsiz, FILE *fp, int *istrunc);
|
||||||
static int ftpcmd(char *s1, char *s2, FILE *fp, char *buf);
|
static int ftpcmd(char *s1, char *s2, FILE *fp, char *buf);
|
||||||
static void progressmeter(int flag);
|
|
||||||
|
|
||||||
/* Globals (can be accessed from signal handlers */
|
/* Globals (can be accessed from signal handlers */
|
||||||
static off_t filesize = 0; /* content-length of the file */
|
static off_t filesize = 0; /* content-length of the file */
|
||||||
static int chunked = 0; /* chunked transfer encoding */
|
static int chunked = 0; /* chunked transfer encoding */
|
||||||
#ifdef BB_FEATURE_WGET_STATUSBAR
|
#ifdef BB_FEATURE_WGET_STATUSBAR
|
||||||
|
static void progressmeter(int flag);
|
||||||
static char *curfile; /* Name of current file being transferred. */
|
static char *curfile; /* Name of current file being transferred. */
|
||||||
static struct timeval start; /* Time a transfer started. */
|
static struct timeval start; /* Time a transfer started. */
|
||||||
static volatile unsigned long statbytes = 0; /* Number of bytes transferred so far. */
|
static volatile unsigned long statbytes = 0; /* Number of bytes transferred so far. */
|
||||||
@ -817,7 +817,7 @@ progressmeter(int flag)
|
|||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: wget.c,v 1.44 2001/07/19 19:13:55 kraai Exp $
|
* $Id: wget.c,v 1.45 2001/07/19 22:28:01 andersen Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -147,9 +147,8 @@ extern int kill_main(int argc, char **argv)
|
|||||||
const struct signal_name *s = signames;
|
const struct signal_name *s = signames;
|
||||||
|
|
||||||
while (s->name != 0) {
|
while (s->name != 0) {
|
||||||
col +=
|
col += fprintf(stderr, "%2d) %-8s", s->number, s->name);
|
||||||
fprintf(stderr, "%2d) %-8s", s->number,
|
s++;
|
||||||
(s++)->name);
|
|
||||||
if (col > 60) {
|
if (col > 60) {
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
col = 0;
|
col = 0;
|
||||||
|
@ -127,14 +127,20 @@ extern int logger_main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
openlog(name, option, (pri | LOG_FACMASK));
|
||||||
if (optind == argc) {
|
if (optind == argc) {
|
||||||
/* read from stdin */
|
do {
|
||||||
i = 0;
|
/* read from stdin */
|
||||||
while ((c = getc(stdin)) != EOF && i < sizeof(buf)) {
|
i = 0;
|
||||||
buf[i++] = c;
|
while ((c = getc(stdin)) != EOF && c != '\n' &&
|
||||||
}
|
i < (sizeof(buf)-1)) {
|
||||||
buf[i++] = '\0';
|
buf[i++] = c;
|
||||||
message = buf;
|
}
|
||||||
|
if (i > 0) {
|
||||||
|
buf[i++] = '\0';
|
||||||
|
syslog(pri, "%s", buf);
|
||||||
|
}
|
||||||
|
} while (c != EOF);
|
||||||
} else {
|
} else {
|
||||||
len = 1; /* for the '\0' */
|
len = 1; /* for the '\0' */
|
||||||
message=xcalloc(1, 1);
|
message=xcalloc(1, 1);
|
||||||
@ -146,12 +152,10 @@ extern int logger_main(int argc, char **argv)
|
|||||||
strcat(message, " ");
|
strcat(message, " ");
|
||||||
}
|
}
|
||||||
message[strlen(message)-1] = '\0';
|
message[strlen(message)-1] = '\0';
|
||||||
|
syslog(pri, "%s", message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*openlog(name, option, (pri | LOG_FACMASK));
|
closelog();
|
||||||
syslog(pri, "%s", message);
|
|
||||||
closelog();*/
|
|
||||||
syslog_msg_with_name(name,(pri | LOG_FACMASK),pri,message);
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
60
update.c
60
update.c
@ -65,46 +65,44 @@ extern int update_main(int argc, char **argv)
|
|||||||
show_usage();
|
show_usage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (daemon(0, 1) < 0)
|
||||||
|
perror_msg_and_die("daemon");
|
||||||
|
|
||||||
pid = fork();
|
/* Become a proper daemon */
|
||||||
if (pid < 0)
|
setsid();
|
||||||
return EXIT_FAILURE;
|
chdir("/");
|
||||||
else if (pid == 0) {
|
|
||||||
/* Become a proper daemon */
|
|
||||||
setsid();
|
|
||||||
chdir("/");
|
|
||||||
#ifdef OPEN_MAX
|
#ifdef OPEN_MAX
|
||||||
for (pid = 0; pid < OPEN_MAX; pid++) close(pid);
|
for (pid = 0; pid < OPEN_MAX; pid++) close(pid);
|
||||||
#else
|
#else
|
||||||
/* glibc 2.1.92 requires using sysconf(_SC_OPEN_MAX) */
|
/* glibc 2.1.92 requires using sysconf(_SC_OPEN_MAX) */
|
||||||
for (pid = 0; pid < sysconf(_SC_OPEN_MAX); pid++) close(pid);
|
for (pid = 0; pid < sysconf(_SC_OPEN_MAX); pid++) close(pid);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/* This is no longer necessary since 1.3.5x, but it will harmlessly
|
||||||
* This is no longer necessary since 1.3.5x, but it will harmlessly
|
* exit if that is the case.
|
||||||
* exit if that is the case.
|
*/
|
||||||
*/
|
|
||||||
|
|
||||||
/* set the program name that will show up in a 'ps' listing */
|
/* set the program name that will show up in a 'ps' listing */
|
||||||
argv[0] = "bdflush (update)";
|
argv[0] = "bdflush (update)";
|
||||||
argv[1] = NULL;
|
argv[1] = NULL;
|
||||||
argv[2] = NULL;
|
argv[2] = NULL;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (use_sync) {
|
if (use_sync) {
|
||||||
sleep(sync_duration);
|
sleep(sync_duration);
|
||||||
sync();
|
sync();
|
||||||
} else {
|
} else {
|
||||||
sleep(flush_duration);
|
sleep(flush_duration);
|
||||||
if (bdflush(1, 0) < 0) {
|
if (bdflush(1, 0) < 0) {
|
||||||
openlog("update", LOG_CONS, LOG_DAEMON);
|
openlog("update", LOG_CONS, LOG_DAEMON);
|
||||||
syslog(LOG_INFO,
|
syslog(LOG_INFO,
|
||||||
"This kernel does not need update(8). Exiting.");
|
"This kernel does not need update(8). Exiting.");
|
||||||
closelog();
|
closelog();
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
15
uudecode.c
15
uudecode.c
@ -207,6 +207,8 @@ static int decode (const char *inname,
|
|||||||
char buf[2 * BUFSIZ];
|
char buf[2 * BUFSIZ];
|
||||||
char *outname;
|
char *outname;
|
||||||
int do_base64 = 0;
|
int do_base64 = 0;
|
||||||
|
int res;
|
||||||
|
int dofre;
|
||||||
|
|
||||||
/* Search for header line. */
|
/* Search for header line. */
|
||||||
|
|
||||||
@ -226,6 +228,7 @@ static int decode (const char *inname,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* If the output file name is given on the command line this rules. */
|
/* If the output file name is given on the command line this rules. */
|
||||||
|
dofre = FALSE;
|
||||||
if (forced_outname != NULL)
|
if (forced_outname != NULL)
|
||||||
outname = (char *) forced_outname;
|
outname = (char *) forced_outname;
|
||||||
else {
|
else {
|
||||||
@ -248,10 +251,11 @@ static int decode (const char *inname,
|
|||||||
}
|
}
|
||||||
n = strlen (pw->pw_dir);
|
n = strlen (pw->pw_dir);
|
||||||
n1 = strlen (p);
|
n1 = strlen (p);
|
||||||
outname = (char *) alloca ((size_t) (n + n1 + 2));
|
outname = (char *) xmalloc ((size_t) (n + n1 + 2));
|
||||||
memcpy (outname + n + 1, p, (size_t) (n1 + 1));
|
memcpy (outname + n + 1, p, (size_t) (n1 + 1));
|
||||||
memcpy (outname, pw->pw_dir, (size_t) n);
|
memcpy (outname, pw->pw_dir, (size_t) n);
|
||||||
outname[n] = '/';
|
outname[n] = '/';
|
||||||
|
dofre = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,6 +265,8 @@ static int decode (const char *inname,
|
|||||||
|| chmod (outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO))
|
|| chmod (outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO))
|
||||||
)) {
|
)) {
|
||||||
perror_msg("%s", outname); /* */
|
perror_msg("%s", outname); /* */
|
||||||
|
if (dofre)
|
||||||
|
free(outname);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -269,9 +275,12 @@ static int decode (const char *inname,
|
|||||||
|
|
||||||
/* For each input line: */
|
/* For each input line: */
|
||||||
if (do_base64)
|
if (do_base64)
|
||||||
return read_base64 (inname);
|
res = read_base64 (inname);
|
||||||
else
|
else
|
||||||
return read_stduu (inname);
|
res = read_stduu (inname);
|
||||||
|
if (dofre)
|
||||||
|
free(outname);
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
int uudecode_main (int argc,
|
int uudecode_main (int argc,
|
||||||
|
4
vi.c
4
vi.c
@ -19,7 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static const char vi_Version[] =
|
static const char vi_Version[] =
|
||||||
"$Id: vi.c,v 1.12 2001/07/17 01:12:36 andersen Exp $";
|
"$Id: vi.c,v 1.13 2001/07/19 22:28:01 andersen Exp $";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* To compile for standalone use:
|
* To compile for standalone use:
|
||||||
@ -3554,7 +3554,7 @@ static int file_write(Byte * fn, Byte * first, Byte * last)
|
|||||||
}
|
}
|
||||||
charcnt = 0;
|
charcnt = 0;
|
||||||
// FIXIT- use the correct umask()
|
// FIXIT- use the correct umask()
|
||||||
fd = open((char *) fn, (O_RDWR | O_CREAT | O_TRUNC), 0664);
|
fd = open((char *) fn, (O_WRONLY | O_CREAT | O_TRUNC), 0664);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return (-1);
|
return (-1);
|
||||||
cnt = last - first + 1;
|
cnt = last - first + 1;
|
||||||
|
4
wget.c
4
wget.c
@ -56,12 +56,12 @@ static void parse_url(char *url, struct host_info *h);
|
|||||||
static FILE *open_socket(char *host, int port);
|
static FILE *open_socket(char *host, int port);
|
||||||
static char *gethdr(char *buf, size_t bufsiz, FILE *fp, int *istrunc);
|
static char *gethdr(char *buf, size_t bufsiz, FILE *fp, int *istrunc);
|
||||||
static int ftpcmd(char *s1, char *s2, FILE *fp, char *buf);
|
static int ftpcmd(char *s1, char *s2, FILE *fp, char *buf);
|
||||||
static void progressmeter(int flag);
|
|
||||||
|
|
||||||
/* Globals (can be accessed from signal handlers */
|
/* Globals (can be accessed from signal handlers */
|
||||||
static off_t filesize = 0; /* content-length of the file */
|
static off_t filesize = 0; /* content-length of the file */
|
||||||
static int chunked = 0; /* chunked transfer encoding */
|
static int chunked = 0; /* chunked transfer encoding */
|
||||||
#ifdef BB_FEATURE_WGET_STATUSBAR
|
#ifdef BB_FEATURE_WGET_STATUSBAR
|
||||||
|
static void progressmeter(int flag);
|
||||||
static char *curfile; /* Name of current file being transferred. */
|
static char *curfile; /* Name of current file being transferred. */
|
||||||
static struct timeval start; /* Time a transfer started. */
|
static struct timeval start; /* Time a transfer started. */
|
||||||
static volatile unsigned long statbytes = 0; /* Number of bytes transferred so far. */
|
static volatile unsigned long statbytes = 0; /* Number of bytes transferred so far. */
|
||||||
@ -817,7 +817,7 @@ progressmeter(int flag)
|
|||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: wget.c,v 1.44 2001/07/19 19:13:55 kraai Exp $
|
* $Id: wget.c,v 1.45 2001/07/19 22:28:01 andersen Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user