merge post-1.3.0 fixes

This commit is contained in:
Denis Vlasenko 2006-12-26 18:17:42 +00:00
parent 270c17c0e6
commit 666da5e2c6
12 changed files with 48 additions and 21 deletions

View File

@ -9,6 +9,7 @@
char get_header_ar(archive_handle_t *archive_handle)
{
int err;
file_header_t *typed = archive_handle->file_header;
union {
char raw[60];
@ -45,15 +46,23 @@ char get_header_ar(archive_handle_t *archive_handle)
archive_handle->offset += 60;
/* align the headers based on the header magic */
if ((ar.formatted.magic[0] != '`') || (ar.formatted.magic[1] != '\n')) {
if (ar.formatted.magic[0] != '`' || ar.formatted.magic[1] != '\n')
bb_error_msg_and_die("invalid ar header");
}
typed->mode = xstrtoul(ar.formatted.mode, 8);
typed->mtime = xatou(ar.formatted.date);
typed->uid = xatou(ar.formatted.uid);
typed->gid = xatou(ar.formatted.gid);
typed->size = xatoul(ar.formatted.size);
/* FIXME: more thorough routine would be in order here */
/* (we have something like that in tar) */
/* but for now we are lax. This code works because */
/* on misformatted numbers bb_strtou returns all-ones */
typed->mode = err = bb_strtou(ar.formatted.mode, NULL, 8);
if (err == -1) bb_error_msg_and_die("invalid ar header");
typed->mtime = err = bb_strtou(ar.formatted.date, NULL, 10);
if (err == -1) bb_error_msg_and_die("invalid ar header");
typed->uid = err = bb_strtou(ar.formatted.uid, NULL, 10);
if (err == -1) bb_error_msg_and_die("invalid ar header");
typed->gid = err = bb_strtou(ar.formatted.gid, NULL, 10);
if (err == -1) bb_error_msg_and_die("invalid ar header");
typed->size = err = bb_strtou(ar.formatted.size, NULL, 10);
if (err == -1) bb_error_msg_and_die("invalid ar header");
/* long filenames have '/' as the first character */
if (ar.formatted.name[0] == '/') {

View File

@ -74,8 +74,10 @@ char get_header_tar(archive_handle_t *archive_handle)
if (sizeof(tar) != 512)
BUG_tar_header_size();
again:
#if ENABLE_FEATURE_TAR_GNU_EXTENSIONS
again:
#endif
/* Align header */
data_align(archive_handle, 512);

View File

@ -120,7 +120,6 @@ struct sed_globals {
} bbg;
void sed_free_and_close_stuff(void);
#if ENABLE_FEATURE_CLEAN_UP
static void sed_free_and_close_stuff(void)
{
@ -156,6 +155,8 @@ static void sed_free_and_close_stuff(void)
while (bbg.current_input_file < bbg.input_file_count)
fclose(bbg.input_file_list[bbg.current_input_file++]);
}
#else
void sed_free_and_close_stuff(void);
#endif
/* If something bad happens during -i operation, delete temp file */

View File

@ -76,6 +76,7 @@ static action ***actions;
static int need_print = 1;
#if ENABLE_FEATURE_FIND_EXEC
static int count_subst(const char *str)
{
int count = 0;
@ -103,6 +104,7 @@ static char* subst(const char *src, int count, const char* filename)
strcpy(dst, src);
return buf;
}
#endif
static int exec_actions(action ***appp, const char *fileName, struct stat *statbuf)
@ -556,8 +558,8 @@ int find_main(int argc, char **argv)
argp[0] = "-a";
}
argp++;
}
#endif
}
actions = parse_params(&argv[firstopt]);

View File

@ -51,7 +51,9 @@
#include "pwd_.h"
#include "grp_.h"
#if ENABLE_FEATURE_SHADOWPASSWDS
#include "shadow_.h"
#endif
/* Try to pull in PATH_MAX */
#include <limits.h>

View File

@ -113,5 +113,6 @@ lib-$(CONFIG_EJECT) += find_mount_point.o
lib-$(CONFIG_AWK) += xregcomp.o
lib-$(CONFIG_SED) += xregcomp.o
lib-$(CONFIG_LESS) += xregcomp.o
lib-$(CONFIG_GREP) += xregcomp.o
lib-$(CONFIG_MDEV) += xregcomp.o
lib-$(CONFIG_DEVFSD) += xregcomp.o

View File

@ -17,6 +17,7 @@
* errno = ERANGE if value had alphanumeric terminating char ("1234abcg").
* errno = ERANGE if value is out of range, missing, etc.
* errno = ERANGE if value had minus sign for strtouXX (even "-0" is not ok )
* return value is all-ones in this case.
*/
static unsigned long long ret_ERANGE(void)

View File

@ -7,10 +7,13 @@
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include "libbb.h"
/* gcc warns about a null format string, therefore we provide
* modified definition without "attribute (format)"
* instead of including libbb.h */
//#include "libbb.h"
extern void bb_perror_msg(const char *s, ...);
void bb_perror_nomsg(void)
{
/* Ignore the gcc warning about a null format string. */
bb_perror_msg(NULL);
bb_perror_msg(0);
}

View File

@ -7,11 +7,13 @@
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include <stddef.h>
#include "libbb.h"
/* gcc warns about a null format string, therefore we provide
* modified definition without "attribute (format)"
* instead of including libbb.h */
//#include "libbb.h"
extern void bb_perror_msg_and_die(const char *s, ...);
void bb_perror_nomsg_and_die(void)
{
/* Ignore the gcc warning about a null format string. */
bb_perror_msg_and_die(NULL);
bb_perror_msg_and_die(0);
}

View File

@ -257,7 +257,8 @@ static void dhcprelay_loop(int *fds, int num_sockets, int max_socket, char **cli
{
struct dhcpMessage dhcp_msg;
fd_set rfds;
size_t packlen, addr_size;
size_t packlen;
socklen_t addr_size;
struct sockaddr_in client_addr;
struct timeval tv;
int i;

View File

@ -85,7 +85,7 @@
#ifdef CONFIG_ASH_JOB_CONTROL
#define JOBS 1
#else
#undef JOBS
#define JOBS 0
#endif
#if JOBS || defined(CONFIG_ASH_READ_NCHARS)
@ -6647,7 +6647,7 @@ usage:
}
#endif /* JOBS */
#if defined(JOBS) || DEBUG
#if JOBS || DEBUG
static int
jobno(const struct job *jp)
{

View File

@ -1708,10 +1708,13 @@ int mount_main(int argc, char **argv)
// Mount this thing.
// NFS mounts want this to be xrealloc-able
mtcur->mnt_opts = xstrdup(mtcur->mnt_opts);
if (singlemount(mtcur, 1)) {
/* Count number of failed mounts */
rc++;
}
free(mtcur->mnt_opts);
}
}
if (ENABLE_FEATURE_CLEAN_UP) endmntent(fstab);