char get_header_ar(archive_handle_t *archive_handle)
{
+ int err;
file_header_t *typed = archive_handle->file_header;
union {
char raw[60];
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] == '/') {
if (sizeof(tar) != 512)
BUG_tar_header_size();
- again:
+#if ENABLE_FEATURE_TAR_GNU_EXTENSIONS
+ again:
+#endif
/* Align header */
data_align(archive_handle, 512);
} bbg;
-void sed_free_and_close_stuff(void);
#if ENABLE_FEATURE_CLEAN_UP
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 */
}
+#if ENABLE_FEATURE_FIND_EXEC
static int count_subst(const char *str)
{
int count = 0;
strcpy(dst, src);
return buf;
}
+#endif
static int exec_actions(action ***appp, const char *fileName, struct stat *statbuf)
argp[0] = "-a";
}
argp++;
- }
#endif
+ }
actions = parse_params(&argv[firstopt]);
#include "pwd_.h"
#include "grp_.h"
+#if ENABLE_FEATURE_SHADOWPASSWDS
#include "shadow_.h"
+#endif
/* Try to pull in PATH_MAX */
#include <limits.h>
unsigned long bb_strtoul(const char *arg, char **endp, int base)
{ return bb_strtoull(arg, endp, base); }
extern inline
-unsigned long bb_strtol(const char *arg, char **endp, int base)
+long bb_strtol(const char *arg, char **endp, int base)
{ return bb_strtoll(arg, endp, base); }
#else
unsigned long bb_strtoul(const char *arg, char **endp, int base);
#if UINT_MAX == ULLONG_MAX
extern inline
-unsigned long bb_strtou(const char *arg, char **endp, int base)
+unsigned bb_strtou(const char *arg, char **endp, int base)
{ return bb_strtoull(arg, endp, base); }
extern inline
-unsigned long bb_strtoi(const char *arg, char **endp, int base)
+int bb_strtoi(const char *arg, char **endp, int base)
{ return bb_strtoll(arg, endp, base); }
#elif UINT_MAX == ULONG_MAX
extern inline
-unsigned long bb_strtou(const char *arg, char **endp, int base)
+unsigned bb_strtou(const char *arg, char **endp, int base)
{ return bb_strtoul(arg, endp, base); }
extern inline
-unsigned long bb_strtoi(const char *arg, char **endp, int base)
+int bb_strtoi(const char *arg, char **endp, int base)
{ return bb_strtol(arg, endp, base); }
#else
-unsigned long bb_strtou(const char *arg, char **endp, int base);
-long bb_strtoi(const char *arg, char **endp, int base);
+unsigned bb_strtou(const char *arg, char **endp, int base);
+int bb_strtoi(const char *arg, char **endp, int base);
#endif
int BUG_bb_strtou32_unimplemented(void);
lib-$(CONFIG_AWK) += xregcomp.o
lib-$(CONFIG_SED) += xregcomp.o
+lib-$(CONFIG_GREP) += xregcomp.o
lib-$(CONFIG_LESS) += xregcomp.o
+lib-$(CONFIG_MDEV) += xregcomp.o
lib-$(CONFIG_DEVFSD) += xregcomp.o
* 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)
* 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);
}
* 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);
}
{
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;
#ifdef CONFIG_ASH_JOB_CONTROL
#define JOBS 1
#else
-#undef JOBS
+#define JOBS 0
#endif
#if JOBS || defined(CONFIG_ASH_READ_NCHARS)
}
#endif /* JOBS */
-#if defined(JOBS) || DEBUG
+#if JOBS || DEBUG
static int
jobno(const struct job *jp)
{
// 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);