From: Bdale Garbee Date: Mon, 11 Aug 2008 20:55:58 +0000 (-0300) Subject: patch from Brian Carlson for Debian X-Git-Tag: debian/20090728-1~20 X-Git-Url: https://git.gag.com/?p=debian%2Fpax;a=commitdiff_plain;h=49a7b7da8f016651569328d1f3f6cc0df9fead00 patch from Brian Carlson for Debian --- diff --git a/gen_subs.c b/gen_subs.c index 07c9e96..912c32c 100644 --- a/gen_subs.c +++ b/gen_subs.c @@ -69,6 +69,9 @@ static const char rcsid[] = "$OpenBSD: gen_subs.c,v 1.19 2007/04/04 21:55:10 mil */ #define MODELEN 20 #define DATELEN 64 +#define DAYSPERNYEAR 365 +#define SECSPERDAY 86400 +#define VIS_CSTYLE 0 #define SIXMONTHS ((DAYSPERNYEAR / 2) * SECSPERDAY) #define CURFRMT "%b %e %H:%M" #define OLDFRMT "%b %e %Y" @@ -209,7 +212,7 @@ safe_print(const char *str, FILE *fp) /* * if printing to a tty, use vis(3) to print special characters. */ - if (isatty(fileno(fp))) { + if (0 && isatty(fileno(fp))) { for (cp = str; *cp; cp++) { (void)vis(visbuf, cp[0], VIS_CSTYLE, cp[1]); (void)fputs(visbuf, fp); diff --git a/options.c b/options.c index 4cc16d7..36291d1 100644 --- a/options.c +++ b/options.c @@ -74,7 +74,7 @@ static int no_op(void); static void printflg(unsigned int); static int c_frmt(const void *, const void *); static off_t str_offt(char *); -static char *getline(FILE *fp); +static char *bsd_getline(FILE *fp); static void pax_options(int, char **); static void pax_usage(void); static void tar_options(int, char **); @@ -884,7 +884,7 @@ tar_options(int argc, char **argv) paxwarn(1, "Unable to open file '%s' for read", file); tar_usage(); } - while ((str = getline(fp)) != NULL) { + while ((str = bsd_getline(fp)) != NULL) { if (pat_add(str, dir) < 0) tar_usage(); sawpat = 1; @@ -963,7 +963,7 @@ tar_options(int argc, char **argv) paxwarn(1, "Unable to open file '%s' for read", file); tar_usage(); } - while ((str = getline(fp)) != NULL) { + while ((str = bsd_getline(fp)) != NULL) { if (ftree_add(str, 0) < 0) tar_usage(); } @@ -1185,7 +1185,7 @@ cpio_options(int argc, char **argv) paxwarn(1, "Unable to open file '%s' for read", optarg); cpio_usage(); } - while ((str = getline(fp)) != NULL) { + while ((str = bsd_getline(fp)) != NULL) { pat_add(str, NULL); } fclose(fp); @@ -1284,7 +1284,7 @@ cpio_options(int argc, char **argv) * no read errors allowed on updates/append operation! */ maxflt = 0; - while ((str = getline(stdin)) != NULL) { + while ((str = bsd_getline(stdin)) != NULL) { ftree_add(str, 0); } if (getline_error) { @@ -1461,7 +1461,7 @@ str_offt(char *val) if ((num == LONG_MAX) || (num <= 0) || (expr == val)) # else num = strtoq(val, &expr, 0); - if ((num == QUAD_MAX) || (num <= 0) || (expr == val)) + if ((num == LLONG_MAX) || (num <= 0) || (expr == val)) # endif return(0); @@ -1513,7 +1513,7 @@ str_offt(char *val) } char * -getline(FILE *f) +bsd_getline(FILE *f) { char *name, *temp; size_t len; diff --git a/pax.c b/pax.c index 3c3d2b4..5e2ec59 100644 --- a/pax.c +++ b/pax.c @@ -105,7 +105,7 @@ char *dirptr; /* destination dir in a copy */ char *ltmfrmt; /* -v locale time format (if any) */ char *argv0; /* root of argv[0] */ sigset_t s_mask; /* signal mask for cleanup critical sect */ -FILE *listf = stderr; /* file pointer to print file list to */ +FILE *listf; /* file pointer to print file list to */ char *tempfile; /* tempfile to use for mkstemp(3) */ char *tempbase; /* basename of tempfile to use for mkstemp(3) */ @@ -235,6 +235,12 @@ main(int argc, char **argv) char *tmpdir; size_t tdlen; + /* + * On some systems, stderr is not a constant, so we initialize listf + * immediately to emulate the behavior. + */ + listf=stderr; + /* * Keep a reference to cwd, so we can always come back home. */ diff --git a/sel_subs.c b/sel_subs.c index b12c3ed..38fd84b 100644 --- a/sel_subs.c +++ b/sel_subs.c @@ -53,12 +53,14 @@ static const char rcsid[] = "$OpenBSD: sel_subs.c,v 1.18 2004/04/16 22:50:23 der #include #include #include -#include +#include #include #include "pax.h" #include "sel_subs.h" #include "extern.h" +#define TM_YEAR_BASE 1900 + static int str_sec(const char *, time_t *); static int usr_match(ARCHD *); static int grp_match(ARCHD *);