patch from Brian Carlson for Debian
authorBdale Garbee <bdale@gag.com>
Mon, 11 Aug 2008 20:55:58 +0000 (17:55 -0300)
committerBdale Garbee <bdale@gag.com>
Mon, 11 Aug 2008 20:55:58 +0000 (17:55 -0300)
gen_subs.c
options.c
pax.c
sel_subs.c

index 07c9e96b26db9c73c573433d11c70957a8dc979d..912c32cdc87af2f84a84a9e947b226b05d5bef42 100644 (file)
@@ -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);
index 4cc16d723e888b56a24f00739bfa9493cbfbe525..36291d1e27a64b4d24bd322aa518b4676fb68a67 100644 (file)
--- 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 3c3d2b4719704c8b0f9917a55f419d828d60b08e..5e2ec59084ce98c0322b818b83b1999de61c2418 100644 (file)
--- 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.
         */
index b12c3edf50e4e3dda05f85654402caaf033b1279..38fd84beda5d90a26ce1e81edd7fc52e4285cc60 100644 (file)
@@ -53,12 +53,14 @@ static const char rcsid[] = "$OpenBSD: sel_subs.c,v 1.18 2004/04/16 22:50:23 der
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <tzfile.h>
+#include <time.h>
 #include <unistd.h>
 #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 *);