diff options
Diffstat (limited to 'bin/pax/tar.c')
-rw-r--r-- | bin/pax/tar.c | 44 |
1 files changed, 6 insertions, 38 deletions
diff --git a/bin/pax/tar.c b/bin/pax/tar.c index 3a458223bddd..50a9a41623ca 100644 --- a/bin/pax/tar.c +++ b/bin/pax/tar.c @@ -33,14 +33,6 @@ * SUCH DAMAGE. */ -#ifndef lint -#if 0 -static char sccsid[] = "@(#)tar.c 8.2 (Berkeley) 4/18/94"; -#endif -#endif /* not lint */ -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - #include <sys/types.h> #include <sys/time.h> #include <sys/stat.h> @@ -57,9 +49,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 +180,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 +233,6 @@ uqd_oct(u_quad_t val, char *str, int len, int term) return(-1); return(0); } -#endif /* * tar_chksm() @@ -399,13 +387,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; /* @@ -562,12 +545,12 @@ tar_wr(ARCHD *arcn) } /* - * copy the data out of the ARCHD into the tar header based on the type - * of the file. Remember many tar readers want the unused fields to be - * padded with zero. We set the linkflag field (type), the linkname - * (or zero if not used),the size, and set the padding (if any) to be - * added after the file data (0 for all other types, as they only have - * a header) + * Copy the data out of the ARCHD into the tar header based on the type + * of the file. Remember, many tar readers want all fields to be + * padded with zero so we zero the header first. We then set the + * linkflag field (type), the linkname, the size, and set the padding + * (if any) to be added after the file data (0 for all other types, + * as they only have a header). */ hd = &hdblk; l_strncpy(hd->name, arcn->name, sizeof(hd->name) - 1); @@ -609,13 +592,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 +754,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 +984,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); } |