pax: remove 4.4BSD compatibility
Sponsored by: Klara, Inc.
This commit is contained in:
parent
0e6e2c4ef3
commit
30c30e220a
@ -3,30 +3,6 @@
|
||||
|
||||
.include <src.opts.mk>
|
||||
|
||||
# To install on versions prior to BSD 4.4 the following may have to be
|
||||
# defined with CFLAGS +=
|
||||
#
|
||||
# -DNET2_STAT Use NET2 or older stat structure. The version of the
|
||||
# stat structure is easily determined by looking at the
|
||||
# basic type of an off_t (often defined in the file:
|
||||
# /usr/include/sys/types.h). If off_t is a long (and is
|
||||
# NOT A quad) then you must define NET2_STAT.
|
||||
# This define is important, as if you do have a quad_t
|
||||
# off_t and define NET2_STAT, pax will compile but will
|
||||
# NOT RUN PROPERLY.
|
||||
#
|
||||
# -DNET2_FTS Use the older NET2 fts. To identify the version,
|
||||
# examine the file: /usr/include/fts.h. If FTS_COMFOLLOW
|
||||
# is not defined then you must define NET2_FTS.
|
||||
# Pax may not compile if this not (un)defined properly.
|
||||
#
|
||||
# -DNET2_REGEX Use the older regexp.h not regex.h. The regex version
|
||||
# is determined by looking at the value returned by
|
||||
# regexec() (man 3 regexec). If regexec return a 1 for
|
||||
# success (and NOT a 0 for success) you have the older
|
||||
# regex routines and must define NET2_REGEX.
|
||||
# Pax may not compile if this not (un)defined properly.
|
||||
|
||||
PACKAGE=runtime
|
||||
PROG= pax
|
||||
SRCS= ar_io.c ar_subs.c buf_subs.c cache.c cpio.c file_subs.c ftree.c \
|
||||
|
@ -386,13 +386,8 @@ ar_close(void)
|
||||
* could have written anything yet.
|
||||
*/
|
||||
if (frmt == NULL) {
|
||||
# ifdef NET2_STAT
|
||||
(void)fprintf(listf, "%s: unknown format, %lu bytes skipped.\n",
|
||||
argv0, rdcnt);
|
||||
# else
|
||||
(void)fprintf(listf, "%s: unknown format, %ju bytes skipped.\n",
|
||||
argv0, (uintmax_t)rdcnt);
|
||||
# endif
|
||||
(void)fflush(listf);
|
||||
flcnt = 0;
|
||||
return;
|
||||
@ -403,14 +398,9 @@ ar_close(void)
|
||||
(unsigned long long)((rdcnt ? rdcnt : wrcnt) / 5120));
|
||||
else if (strcmp(NM_TAR, argv0) != 0)
|
||||
(void)fprintf(listf,
|
||||
# ifdef NET2_STAT
|
||||
"%s: %s vol %d, %lu files, %lu bytes read, %lu bytes written.\n",
|
||||
argv0, frmt->name, arvol-1, flcnt, rdcnt, wrcnt);
|
||||
# else
|
||||
"%s: %s vol %d, %ju files, %ju bytes read, %ju bytes written.\n",
|
||||
argv0, frmt->name, arvol-1, (uintmax_t)flcnt,
|
||||
(uintmax_t)rdcnt, (uintmax_t)wrcnt);
|
||||
# endif
|
||||
(void)fflush(listf);
|
||||
flcnt = 0;
|
||||
}
|
||||
|
@ -211,12 +211,8 @@ name_uid(uid_t uid, int frc)
|
||||
return("");
|
||||
ptr->uid = uid;
|
||||
ptr->valid = INVALID;
|
||||
# ifdef NET2_STAT
|
||||
(void)snprintf(ptr->name, sizeof(ptr->name), "%u", uid);
|
||||
# else
|
||||
(void)snprintf(ptr->name, sizeof(ptr->name), "%lu",
|
||||
(unsigned long)uid);
|
||||
# endif
|
||||
if (frc == 0)
|
||||
return("");
|
||||
} else {
|
||||
@ -282,12 +278,8 @@ name_gid(gid_t gid, int frc)
|
||||
return("");
|
||||
ptr->gid = gid;
|
||||
ptr->valid = INVALID;
|
||||
# ifdef NET2_STAT
|
||||
(void)snprintf(ptr->name, sizeof(ptr->name), "%u", gid);
|
||||
# else
|
||||
(void)snprintf(ptr->name, sizeof(ptr->name), "%lu",
|
||||
(unsigned long)gid);
|
||||
# endif
|
||||
if (frc == 0)
|
||||
return("");
|
||||
} else {
|
||||
|
@ -216,13 +216,8 @@ rd_ln_nm(ARCHD *arcn)
|
||||
*/
|
||||
if ((arcn->sb.st_size == 0) ||
|
||||
((size_t)arcn->sb.st_size >= sizeof(arcn->ln_name))) {
|
||||
# ifdef NET2_STAT
|
||||
paxwarn(1, "Cpio link name length is invalid: %lu",
|
||||
arcn->sb.st_size);
|
||||
# else
|
||||
paxwarn(1, "Cpio link name length is invalid: %ju",
|
||||
(uintmax_t)arcn->sb.st_size);
|
||||
# endif
|
||||
return(-1);
|
||||
}
|
||||
|
||||
@ -302,21 +297,11 @@ cpio_rd(ARCHD *arcn, char *buf)
|
||||
arcn->sb.st_nlink = (nlink_t)asc_ul(hd->c_nlink, sizeof(hd->c_nlink),
|
||||
OCT);
|
||||
arcn->sb.st_rdev = (dev_t)asc_ul(hd->c_rdev, sizeof(hd->c_rdev), OCT);
|
||||
#ifdef NET2_STAT
|
||||
arcn->sb.st_mtime = (time_t)asc_ul(hd->c_mtime, sizeof(hd->c_mtime),
|
||||
OCT);
|
||||
#else
|
||||
arcn->sb.st_mtime = (time_t)asc_uqd(hd->c_mtime, sizeof(hd->c_mtime),
|
||||
OCT);
|
||||
#endif
|
||||
arcn->sb.st_ctime = arcn->sb.st_atime = arcn->sb.st_mtime;
|
||||
#ifdef NET2_STAT
|
||||
arcn->sb.st_size = (off_t)asc_ul(hd->c_filesize,sizeof(hd->c_filesize),
|
||||
OCT);
|
||||
#else
|
||||
arcn->sb.st_size = (off_t)asc_uqd(hd->c_filesize,sizeof(hd->c_filesize),
|
||||
OCT);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* check name size and if valid, read in the name of this entry (name
|
||||
@ -411,13 +396,8 @@ cpio_wr(ARCHD *arcn)
|
||||
/*
|
||||
* set data size for file data
|
||||
*/
|
||||
# ifdef NET2_STAT
|
||||
if (ul_asc((u_long)arcn->sb.st_size, hd->c_filesize,
|
||||
sizeof(hd->c_filesize), OCT)) {
|
||||
# else
|
||||
if (uqd_asc((u_quad_t)arcn->sb.st_size, hd->c_filesize,
|
||||
sizeof(hd->c_filesize), OCT)) {
|
||||
# endif
|
||||
paxwarn(1,"File is too large for cpio format %s",
|
||||
arcn->org_name);
|
||||
return(1);
|
||||
@ -593,19 +573,10 @@ vcpio_rd(ARCHD *arcn, char *buf)
|
||||
arcn->sb.st_mode = (mode_t)asc_ul(hd->c_mode, sizeof(hd->c_mode), HEX);
|
||||
arcn->sb.st_uid = (uid_t)asc_ul(hd->c_uid, sizeof(hd->c_uid), HEX);
|
||||
arcn->sb.st_gid = (gid_t)asc_ul(hd->c_gid, sizeof(hd->c_gid), HEX);
|
||||
#ifdef NET2_STAT
|
||||
arcn->sb.st_mtime = (time_t)asc_ul(hd->c_mtime,sizeof(hd->c_mtime),HEX);
|
||||
#else
|
||||
arcn->sb.st_mtime = (time_t)asc_uqd(hd->c_mtime,sizeof(hd->c_mtime),HEX);
|
||||
#endif
|
||||
arcn->sb.st_ctime = arcn->sb.st_atime = arcn->sb.st_mtime;
|
||||
#ifdef NET2_STAT
|
||||
arcn->sb.st_size = (off_t)asc_ul(hd->c_filesize,
|
||||
sizeof(hd->c_filesize), HEX);
|
||||
#else
|
||||
arcn->sb.st_size = (off_t)asc_uqd(hd->c_filesize,
|
||||
sizeof(hd->c_filesize), HEX);
|
||||
#endif
|
||||
arcn->sb.st_nlink = (nlink_t)asc_ul(hd->c_nlink, sizeof(hd->c_nlink),
|
||||
HEX);
|
||||
devmajor = (dev_t)asc_ul(hd->c_maj, sizeof(hd->c_maj), HEX);
|
||||
@ -740,13 +711,8 @@ vcpio_wr(ARCHD *arcn)
|
||||
* much to pad.
|
||||
*/
|
||||
arcn->pad = VCPIO_PAD(arcn->sb.st_size);
|
||||
# ifdef NET2_STAT
|
||||
if (ul_asc((u_long)arcn->sb.st_size, hd->c_filesize,
|
||||
sizeof(hd->c_filesize), HEX)) {
|
||||
# else
|
||||
if (uqd_asc((u_quad_t)arcn->sb.st_size, hd->c_filesize,
|
||||
sizeof(hd->c_filesize), HEX)) {
|
||||
# endif
|
||||
paxwarn(1,"File is too large for sv4cpio format %s",
|
||||
arcn->org_name);
|
||||
return(1);
|
||||
|
@ -169,10 +169,8 @@ void ls_tty(ARCHD *);
|
||||
int l_strncpy(char *, const char *, int);
|
||||
u_long asc_ul(char *, int, int);
|
||||
int ul_asc(u_long, char *, int, int);
|
||||
#ifndef NET2_STAT
|
||||
u_quad_t asc_uqd(char *, int, int);
|
||||
int uqd_asc(u_quad_t, char *, int, int);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* getoldopt.c
|
||||
|
@ -115,11 +115,7 @@ ftree_start(void)
|
||||
else
|
||||
ftsopts |= FTS_PHYSICAL;
|
||||
if (Hflag)
|
||||
# ifdef NET2_FTS
|
||||
paxwarn(0, "The -H flag is not supported on this version");
|
||||
# else
|
||||
ftsopts |= FTS_COMFOLLOW;
|
||||
# endif
|
||||
if (Xflag)
|
||||
ftsopts |= FTS_XDEV;
|
||||
|
||||
@ -402,13 +398,8 @@ next_file(ARCHD *arcn)
|
||||
* remember to force the time (this is -t on a read
|
||||
* directory, not a created directory).
|
||||
*/
|
||||
# ifdef NET2_FTS
|
||||
if (!tflag || (get_atdir(ftent->fts_statb.st_dev,
|
||||
ftent->fts_statb.st_ino, &mtime, &atime) < 0))
|
||||
# else
|
||||
if (!tflag || (get_atdir(ftent->fts_statp->st_dev,
|
||||
ftent->fts_statp->st_ino, &mtime, &atime) < 0))
|
||||
# endif
|
||||
continue;
|
||||
set_ftime(ftent->fts_path, mtime, atime, 1);
|
||||
continue;
|
||||
@ -419,28 +410,16 @@ next_file(ARCHD *arcn)
|
||||
paxwarn(1,"File system cycle found at %s",ftent->fts_path);
|
||||
continue;
|
||||
case FTS_DNR:
|
||||
# ifdef NET2_FTS
|
||||
syswarn(1, errno,
|
||||
# else
|
||||
syswarn(1, ftent->fts_errno,
|
||||
# endif
|
||||
"Unable to read directory %s", ftent->fts_path);
|
||||
continue;
|
||||
case FTS_ERR:
|
||||
# ifdef NET2_FTS
|
||||
syswarn(1, errno,
|
||||
# else
|
||||
syswarn(1, ftent->fts_errno,
|
||||
# endif
|
||||
"File system traversal error");
|
||||
continue;
|
||||
case FTS_NS:
|
||||
case FTS_NSOK:
|
||||
# ifdef NET2_FTS
|
||||
syswarn(1, errno,
|
||||
# else
|
||||
syswarn(1, ftent->fts_errno,
|
||||
# endif
|
||||
"Unable to access %s", ftent->fts_path);
|
||||
continue;
|
||||
}
|
||||
@ -453,11 +432,7 @@ next_file(ARCHD *arcn)
|
||||
arcn->pad = 0;
|
||||
arcn->ln_nlen = 0;
|
||||
arcn->ln_name[0] = '\0';
|
||||
# ifdef NET2_FTS
|
||||
arcn->sb = ftent->fts_statb;
|
||||
# else
|
||||
arcn->sb = *(ftent->fts_statp);
|
||||
# endif
|
||||
|
||||
/*
|
||||
* file type based set up and copy into the arcn struct
|
||||
|
@ -119,19 +119,10 @@ ls_list(ARCHD *arcn, time_t now, FILE *fp)
|
||||
* print device id's for devices, or sizes for other nodes
|
||||
*/
|
||||
if ((arcn->type == PAX_CHR) || (arcn->type == PAX_BLK))
|
||||
# ifdef NET2_STAT
|
||||
(void)fprintf(fp, "%4u,%4u ", MAJOR(sbp->st_rdev),
|
||||
MINOR(sbp->st_rdev));
|
||||
# else
|
||||
(void)fprintf(fp, "%4lu,%4lu ", (unsigned long)MAJOR(sbp->st_rdev),
|
||||
(unsigned long)MINOR(sbp->st_rdev));
|
||||
# endif
|
||||
else {
|
||||
# ifdef NET2_STAT
|
||||
(void)fprintf(fp, "%9lu ", sbp->st_size);
|
||||
# else
|
||||
(void)fprintf(fp, "%9ju ", (uintmax_t)sbp->st_size);
|
||||
# endif
|
||||
}
|
||||
|
||||
/*
|
||||
@ -300,7 +291,6 @@ ul_asc(u_long val, char *str, int len, int base)
|
||||
return(0);
|
||||
}
|
||||
|
||||
#ifndef NET2_STAT
|
||||
/*
|
||||
* asc_uqd()
|
||||
* convert hex/octal character string into a u_quad_t. We do not have to
|
||||
@ -396,4 +386,3 @@ uqd_asc(u_quad_t val, char *str, int len, int base)
|
||||
return(-1);
|
||||
return(0);
|
||||
}
|
||||
#endif
|
||||
|
@ -1434,13 +1434,8 @@ str_offt(char *val)
|
||||
char *expr;
|
||||
off_t num, t;
|
||||
|
||||
# ifdef NET2_STAT
|
||||
num = strtol(val, &expr, 0);
|
||||
if ((num == LONG_MAX) || (num <= 0) || (expr == val))
|
||||
# else
|
||||
num = strtoq(val, &expr, 0);
|
||||
if ((num == QUAD_MAX) || (num <= 0) || (expr == val))
|
||||
# endif
|
||||
return(0);
|
||||
|
||||
switch(*expr) {
|
||||
|
@ -46,11 +46,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef NET2_REGEX
|
||||
#include <regexp.h>
|
||||
#else
|
||||
#include <regex.h>
|
||||
#endif
|
||||
#include "pax.h"
|
||||
#include "pat_rep.h"
|
||||
#include "extern.h"
|
||||
@ -73,11 +69,7 @@ static int tty_rename(ARCHD *);
|
||||
static int fix_path(char *, int *, char *, int);
|
||||
static int fn_match(char *, char *, char **);
|
||||
static char * range_match(char *, int);
|
||||
#ifdef NET2_REGEX
|
||||
static int resub(regexp *, char *, char *, char *);
|
||||
#else
|
||||
static int resub(regex_t *, regmatch_t *, char *, char *, char *, char *);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* rep_add()
|
||||
@ -101,10 +93,8 @@ rep_add(char *str)
|
||||
char *pt1;
|
||||
char *pt2;
|
||||
REPLACE *rep;
|
||||
# ifndef NET2_REGEX
|
||||
int res;
|
||||
char rebuf[BUFSIZ];
|
||||
# endif
|
||||
|
||||
/*
|
||||
* throw out the bad parameters
|
||||
@ -133,13 +123,9 @@ rep_add(char *str)
|
||||
}
|
||||
|
||||
*pt1 = '\0';
|
||||
# ifdef NET2_REGEX
|
||||
if ((rep->rcmp = regcomp(str+1)) == NULL) {
|
||||
# else
|
||||
if ((res = regcomp(&(rep->rcmp), str+1, 0)) != 0) {
|
||||
regerror(res, &(rep->rcmp), rebuf, sizeof(rebuf));
|
||||
paxwarn(1, "%s while compiling regular expression %s", rebuf, str);
|
||||
# endif
|
||||
free(rep);
|
||||
return(-1);
|
||||
}
|
||||
@ -151,11 +137,7 @@ rep_add(char *str)
|
||||
*/
|
||||
*pt1++ = *str;
|
||||
if ((pt2 = strchr(pt1, *str)) == NULL) {
|
||||
# ifdef NET2_REGEX
|
||||
free(rep->rcmp);
|
||||
# else
|
||||
regfree(&rep->rcmp);
|
||||
# endif
|
||||
free(rep);
|
||||
paxwarn(1, "Invalid replacement string %s", str);
|
||||
return(-1);
|
||||
@ -180,11 +162,7 @@ rep_add(char *str)
|
||||
rep->flgs |= PRNT;
|
||||
break;
|
||||
default:
|
||||
# ifdef NET2_REGEX
|
||||
free(rep->rcmp);
|
||||
# else
|
||||
regfree(&rep->rcmp);
|
||||
# endif
|
||||
free(rep);
|
||||
*pt1 = *str;
|
||||
paxwarn(1, "Invalid replacement string option %s", str);
|
||||
@ -865,9 +843,7 @@ rep_name(char *name, int *nlen, int prnt)
|
||||
char *rpt;
|
||||
int found = 0;
|
||||
int res;
|
||||
# ifndef NET2_REGEX
|
||||
regmatch_t pm[MAXSUBEXP];
|
||||
# endif
|
||||
char nname[PAXPATHLEN+1]; /* final result of all replacements */
|
||||
char buf1[PAXPATHLEN+1]; /* where we work on the name */
|
||||
|
||||
@ -894,11 +870,7 @@ rep_name(char *name, int *nlen, int prnt)
|
||||
* check for a successful substitution, if not go to
|
||||
* the next pattern, or cleanup if we were global
|
||||
*/
|
||||
# ifdef NET2_REGEX
|
||||
if (regexec(pt->rcmp, inpt) == 0)
|
||||
# else
|
||||
if (regexec(&(pt->rcmp), inpt, MAXSUBEXP, pm, 0) != 0)
|
||||
# endif
|
||||
break;
|
||||
|
||||
/*
|
||||
@ -909,11 +881,7 @@ rep_name(char *name, int *nlen, int prnt)
|
||||
* do not create a string too long).
|
||||
*/
|
||||
found = 1;
|
||||
# ifdef NET2_REGEX
|
||||
rpt = pt->rcmp->startp[0];
|
||||
# else
|
||||
rpt = inpt + pm[0].rm_so;
|
||||
# endif
|
||||
|
||||
while ((inpt < rpt) && (outpt < endpt))
|
||||
*outpt++ = *inpt++;
|
||||
@ -926,12 +894,8 @@ rep_name(char *name, int *nlen, int prnt)
|
||||
* replacement string and place it the prefix in the
|
||||
* final output. If we have problems, skip it.
|
||||
*/
|
||||
# ifdef NET2_REGEX
|
||||
if ((res = resub(pt->rcmp,pt->nstr,outpt,endpt)) < 0) {
|
||||
# else
|
||||
if ((res = resub(&(pt->rcmp),pm,inpt,pt->nstr,outpt,endpt))
|
||||
< 0) {
|
||||
# endif
|
||||
if (prnt)
|
||||
paxwarn(1, "Replacement name error %s",
|
||||
name);
|
||||
@ -949,11 +913,7 @@ rep_name(char *name, int *nlen, int prnt)
|
||||
* the final result. Make sure we do not overrun the
|
||||
* output buffer
|
||||
*/
|
||||
# ifdef NET2_REGEX
|
||||
inpt = pt->rcmp->endp[0];
|
||||
# else
|
||||
inpt += pm[0].rm_eo - pm[0].rm_so;
|
||||
# endif
|
||||
|
||||
if ((outpt == endpt) || (*inpt == '\0'))
|
||||
break;
|
||||
@ -1012,55 +972,6 @@ rep_name(char *name, int *nlen, int prnt)
|
||||
return(0);
|
||||
}
|
||||
|
||||
#ifdef NET2_REGEX
|
||||
/*
|
||||
* resub()
|
||||
* apply the replacement to the matched expression. expand out the old
|
||||
* style ed(1) subexpression expansion.
|
||||
* Return:
|
||||
* -1 if error, or the number of characters added to the destination.
|
||||
*/
|
||||
|
||||
static int
|
||||
resub(regexp *prog, char *src, char *dest, char *destend)
|
||||
{
|
||||
char *spt;
|
||||
char *dpt;
|
||||
char c;
|
||||
int no;
|
||||
int len;
|
||||
|
||||
spt = src;
|
||||
dpt = dest;
|
||||
while ((dpt < destend) && ((c = *spt++) != '\0')) {
|
||||
if (c == '&')
|
||||
no = 0;
|
||||
else if ((c == '\\') && (*spt >= '0') && (*spt <= '9'))
|
||||
no = *spt++ - '0';
|
||||
else {
|
||||
if ((c == '\\') && ((*spt == '\\') || (*spt == '&')))
|
||||
c = *spt++;
|
||||
*dpt++ = c;
|
||||
continue;
|
||||
}
|
||||
if ((prog->startp[no] == NULL) || (prog->endp[no] == NULL) ||
|
||||
((len = prog->endp[no] - prog->startp[no]) <= 0))
|
||||
continue;
|
||||
|
||||
/*
|
||||
* copy the subexpression to the destination.
|
||||
* fail if we run out of space or the match string is damaged
|
||||
*/
|
||||
if (len > (destend - dpt))
|
||||
len = destend - dpt;
|
||||
if (l_strncpy(dpt, prog->startp[no], len) != len)
|
||||
return(-1);
|
||||
dpt += len;
|
||||
}
|
||||
return(dpt - dest);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/*
|
||||
* resub()
|
||||
@ -1127,4 +1038,3 @@ resub(regex_t *rp, regmatch_t *pm, char *orig, char *src, char *dest,
|
||||
}
|
||||
return(dpt - dest);
|
||||
}
|
||||
#endif
|
||||
|
@ -41,11 +41,7 @@
|
||||
*/
|
||||
typedef struct replace {
|
||||
char *nstr; /* the new string we will substitute with */
|
||||
# ifdef NET2_REGEX
|
||||
regexp *rcmp; /* compiled regular expression used to match */
|
||||
# else
|
||||
regex_t rcmp; /* compiled regular expression used to match */
|
||||
# endif
|
||||
int flgs; /* print conversions? global in operation? */
|
||||
#define PRNT 0x1
|
||||
#define GLOB 0x2
|
||||
|
@ -134,11 +134,7 @@ usr_add(char *str)
|
||||
}
|
||||
uid = (uid_t)pw->pw_uid;
|
||||
} else
|
||||
# ifdef NET2_STAT
|
||||
uid = (uid_t)atoi(str+1);
|
||||
# else
|
||||
uid = (uid_t)strtoul(str+1, NULL, 10);
|
||||
# endif
|
||||
endpwent();
|
||||
|
||||
/*
|
||||
@ -235,11 +231,7 @@ grp_add(char *str)
|
||||
}
|
||||
gid = gr->gr_gid;
|
||||
} else
|
||||
# ifdef NET2_STAT
|
||||
gid = (gid_t)atoi(str+1);
|
||||
# else
|
||||
gid = (gid_t)strtoul(str+1, NULL, 10);
|
||||
# endif
|
||||
endgrent();
|
||||
|
||||
/*
|
||||
|
@ -57,9 +57,7 @@ __FBSDID("$FreeBSD$");
|
||||
static u_long tar_chksm(char *, int);
|
||||
static char *name_split(char *, int);
|
||||
static int ul_oct(u_long, char *, int, int);
|
||||
#ifndef NET2_STAT
|
||||
static int uqd_oct(u_quad_t, char *, int, int);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Routines common to all versions of tar
|
||||
@ -190,7 +188,6 @@ ul_oct(u_long val, char *str, int len, int term)
|
||||
return(0);
|
||||
}
|
||||
|
||||
#ifndef NET2_STAT
|
||||
/*
|
||||
* uqd_oct()
|
||||
* convert an u_quad_t to an octal string. one of many oddball field
|
||||
@ -244,7 +241,6 @@ uqd_oct(u_quad_t val, char *str, int len, int term)
|
||||
return(-1);
|
||||
return(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* tar_chksm()
|
||||
@ -399,13 +395,8 @@ tar_rd(ARCHD *arcn, char *buf)
|
||||
0xfff);
|
||||
arcn->sb.st_uid = (uid_t)asc_ul(hd->uid, sizeof(hd->uid), OCT);
|
||||
arcn->sb.st_gid = (gid_t)asc_ul(hd->gid, sizeof(hd->gid), OCT);
|
||||
#ifdef NET2_STAT
|
||||
arcn->sb.st_size = (off_t)asc_ul(hd->size, sizeof(hd->size), OCT);
|
||||
arcn->sb.st_mtime = (time_t)asc_ul(hd->mtime, sizeof(hd->mtime), OCT);
|
||||
#else
|
||||
arcn->sb.st_size = (off_t)asc_uqd(hd->size, sizeof(hd->size), OCT);
|
||||
arcn->sb.st_mtime = (time_t)asc_uqd(hd->mtime, sizeof(hd->mtime), OCT);
|
||||
#endif
|
||||
arcn->sb.st_ctime = arcn->sb.st_atime = arcn->sb.st_mtime;
|
||||
|
||||
/*
|
||||
@ -609,13 +600,8 @@ tar_wr(ARCHD *arcn)
|
||||
*/
|
||||
hd->linkflag = AREGTYPE;
|
||||
memset(hd->linkname, 0, sizeof(hd->linkname));
|
||||
# ifdef NET2_STAT
|
||||
if (ul_oct((u_long)arcn->sb.st_size, hd->size,
|
||||
sizeof(hd->size), 1)) {
|
||||
# else
|
||||
if (uqd_oct((u_quad_t)arcn->sb.st_size, hd->size,
|
||||
sizeof(hd->size), 1)) {
|
||||
# endif
|
||||
paxwarn(1,"File is too large for tar %s", arcn->org_name);
|
||||
return(1);
|
||||
}
|
||||
@ -776,13 +762,8 @@ ustar_rd(ARCHD *arcn, char *buf)
|
||||
*/
|
||||
arcn->sb.st_mode = (mode_t)(asc_ul(hd->mode, sizeof(hd->mode), OCT) &
|
||||
0xfff);
|
||||
#ifdef NET2_STAT
|
||||
arcn->sb.st_size = (off_t)asc_ul(hd->size, sizeof(hd->size), OCT);
|
||||
arcn->sb.st_mtime = (time_t)asc_ul(hd->mtime, sizeof(hd->mtime), OCT);
|
||||
#else
|
||||
arcn->sb.st_size = (off_t)asc_uqd(hd->size, sizeof(hd->size), OCT);
|
||||
arcn->sb.st_mtime = (time_t)asc_uqd(hd->mtime, sizeof(hd->mtime), OCT);
|
||||
#endif
|
||||
arcn->sb.st_ctime = arcn->sb.st_atime = arcn->sb.st_mtime;
|
||||
|
||||
/*
|
||||
@ -1011,13 +992,8 @@ ustar_wr(ARCHD *arcn)
|
||||
memset(hd->devmajor, 0, sizeof(hd->devmajor));
|
||||
memset(hd->devminor, 0, sizeof(hd->devminor));
|
||||
arcn->pad = TAR_PAD(arcn->sb.st_size);
|
||||
# ifdef NET2_STAT
|
||||
if (ul_oct((u_long)arcn->sb.st_size, hd->size,
|
||||
sizeof(hd->size), 3)) {
|
||||
# else
|
||||
if (uqd_oct((u_quad_t)arcn->sb.st_size, hd->size,
|
||||
sizeof(hd->size), 3)) {
|
||||
# endif
|
||||
paxwarn(1,"File is too long for ustar %s",arcn->org_name);
|
||||
return(1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user