summaryrefslogtreecommitdiff
path: root/archivers/pax/files/tar.c
diff options
context:
space:
mode:
Diffstat (limited to 'archivers/pax/files/tar.c')
-rw-r--r--archivers/pax/files/tar.c102
1 files changed, 51 insertions, 51 deletions
diff --git a/archivers/pax/files/tar.c b/archivers/pax/files/tar.c
index b02ee64421e..dac0f1d7f8c 100644
--- a/archivers/pax/files/tar.c
+++ b/archivers/pax/files/tar.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tar.c,v 1.10 2005/12/01 03:00:01 minskim Exp $ */
+/* $NetBSD: tar.c,v 1.11 2007/03/08 17:18:18 rillig Exp $ */
/*-
* Copyright (c) 1992 Keith Muller.
@@ -48,7 +48,7 @@
#if 0
static char sccsid[] = "@(#)tar.c 8.2 (Berkeley) 4/18/94";
#else
-__RCSID("$NetBSD: tar.c,v 1.10 2005/12/01 03:00:01 minskim Exp $");
+__RCSID("$NetBSD: tar.c,v 1.11 2007/03/08 17:18:18 rillig Exp $");
#endif
#endif /* not lint */
@@ -150,9 +150,9 @@ check_sum(char *hd, size_t hdlen, char *bl, size_t bllen, int quiet)
if (!quiet)
tty_warn(0, "Header checksum %lo does not match %lo",
hdck, blck);
- return(-1);
+ return -1;
}
- return(0);
+ return 0;
}
@@ -211,7 +211,7 @@ tar_trail(char *buf, int in_resync, int *cnt)
* if not all zero it is not a trailer, but MIGHT be a header.
*/
if (i != BLKMULT)
- return(-1);
+ return -1;
/*
* When given a zero block, we must be careful!
@@ -232,9 +232,9 @@ tar_trail(char *buf, int in_resync, int *cnt)
++*cnt;
}
if (*cnt >= NULLCNT)
- return(0);
+ return 0;
}
- return(1);
+ return 1;
}
/*
@@ -287,8 +287,8 @@ ul_oct(u_long val, char *str, int len, int term)
while (pt >= str)
*pt-- = '0';
if (val != (u_long)0)
- return(-1);
- return(0);
+ return -1;
+ return 0;
}
#if !defined(NET2_STAT) && !defined(_LP64)
@@ -342,8 +342,8 @@ ull_oct(unsigned long long val, char *str, int len, int term)
while (pt >= str)
*pt-- = '0';
if (val != (unsigned long long)0)
- return(-1);
- return(0);
+ return -1;
+ return 0;
}
#endif
@@ -406,7 +406,7 @@ tar_id(char *blk, int size)
static int is_ustar = -1;
if (size < BLKMULT)
- return(-1);
+ return -1;
hd = (HD_TAR *)blk;
uhd = (HD_USTAR *)blk;
@@ -418,11 +418,11 @@ tar_id(char *blk, int size)
* checksum. If this is ok we have to assume it is a valid header.
*/
if (hd->name[0] == '\0')
- return(-1);
+ return -1;
if (strncmp(uhd->magic, TMAGIC, TMAGLEN - 1) == 0) {
if (is_ustar == -1) {
is_ustar = 1;
- return(-1);
+ return -1;
} else
tty_warn(0,
"Busted tar archive: has both ustar and old tar "
@@ -453,7 +453,7 @@ tar_opt(void)
tty_warn(1,
"%s=%s is the only supported tar format option",
TAR_OPTION, TAR_NODIR);
- return(-1);
+ return -1;
}
/*
@@ -462,11 +462,11 @@ tar_opt(void)
if ((act != APPND) && (act != ARCHIVE)) {
tty_warn(1, "%s=%s is only supported when writing.",
opt->name, opt->value);
- return(-1);
+ return -1;
}
tar_nodir = 1;
}
- return(0);
+ return 0;
}
@@ -488,7 +488,7 @@ tar_rd(ARCHD *arcn, char *buf)
* we only get proper sized buffers passed to us
*/
if (tar_id(buf, BLKMULT) < 0)
- return(-1);
+ return -1;
memset(arcn, 0, sizeof(*arcn));
arcn->org_name = arcn->name;
arcn->pat = NULL;
@@ -594,7 +594,7 @@ tar_rd(ARCHD *arcn, char *buf)
*pt = '\0';
--arcn->nlen;
}
- return(0);
+ return 0;
}
/*
@@ -625,29 +625,29 @@ tar_wr(ARCHD *arcn)
* user asked that dirs not be written to the archive
*/
if (tar_nodir)
- return(1);
+ return 1;
break;
case PAX_CHR:
tty_warn(1, "Tar cannot archive a character device %s",
arcn->org_name);
- return(1);
+ return 1;
case PAX_BLK:
tty_warn(1,
"Tar cannot archive a block device %s", arcn->org_name);
- return(1);
+ return 1;
case PAX_SCK:
tty_warn(1, "Tar cannot archive a socket %s", arcn->org_name);
- return(1);
+ return 1;
case PAX_FIF:
tty_warn(1, "Tar cannot archive a fifo %s", arcn->org_name);
- return(1);
+ return 1;
case PAX_SLK:
case PAX_HLK:
case PAX_HRG:
if (arcn->ln_nlen > sizeof(hd->linkname)) {
tty_warn(1,"Link name too long for tar %s",
arcn->ln_name);
- return(1);
+ return 1;
}
break;
case PAX_REG:
@@ -664,7 +664,7 @@ tar_wr(ARCHD *arcn)
++len;
if (len >= sizeof(hd->name)) {
tty_warn(1, "File name too long for tar %s", arcn->name);
- return(1);
+ return 1;
}
/*
@@ -714,7 +714,7 @@ tar_wr(ARCHD *arcn)
if (OFFT_OCT(arcn->sb.st_size, hd->size, sizeof(hd->size), 1)) {
tty_warn(1,"File is too large for tar %s",
arcn->org_name);
- return(1);
+ return 1;
}
arcn->pad = TAR_PAD(arcn->sb.st_size);
}
@@ -742,19 +742,19 @@ tar_wr(ARCHD *arcn)
* seems incorrect */
if (wr_rdbuf(hdblk, sizeof(HD_TAR)) < 0)
- return(-1);
+ return -1;
if (wr_skip((off_t)(BLKMULT - sizeof(HD_TAR))) < 0)
- return(-1);
+ return -1;
if ((arcn->type == PAX_CTG) || (arcn->type == PAX_REG))
- return(0);
- return(1);
+ return 0;
+ return 1;
out:
/*
* header field is out of range
*/
tty_warn(1, "Tar header field is too small for %s", arcn->org_name);
- return(1);
+ return 1;
}
/*
@@ -771,7 +771,7 @@ tar_wr(ARCHD *arcn)
int
ustar_strd(void)
{
- return(0);
+ return 0;
}
/*
@@ -784,7 +784,7 @@ ustar_strd(void)
int
ustar_stwr(void)
{
- return(0);
+ return 0;
}
/*
@@ -801,7 +801,7 @@ ustar_id(char *blk, int size)
HD_USTAR *hd;
if (size < BLKMULT)
- return(-1);
+ return -1;
hd = (HD_USTAR *)blk;
/*
@@ -811,9 +811,9 @@ ustar_id(char *blk, int size)
* check the checksum. If ok we have to assume it is a valid header.
*/
if (hd->name[0] == '\0')
- return(-1);
+ return -1;
if (strncmp(hd->magic, TMAGIC, TMAGLEN - 1) != 0)
- return(-1);
+ return -1;
/* This is GNU tar */
if (strncmp(hd->magic, "ustar ", 8) == 0 && !is_gnutar &&
!seen_gnu_warning) {
@@ -845,7 +845,7 @@ ustar_rd(ARCHD *arcn, char *buf)
* we only get proper sized buffers
*/
if (ustar_id(buf, BLKMULT) < 0)
- return(-1);
+ return -1;
memset(arcn, 0, sizeof(*arcn));
arcn->org_name = arcn->name;
@@ -989,7 +989,7 @@ ustar_rd(ARCHD *arcn, char *buf)
arcn->sb.st_mode |= S_IFREG;
break;
}
- return(0);
+ return 0;
}
static int
@@ -1077,7 +1077,7 @@ ustar_wr(ARCHD *arcn)
if (!is_gnutar)
tty_warn(1, "Ustar cannot archive a socket %s",
arcn->org_name);
- return(1);
+ return 1;
case PAX_SLK:
case PAX_HLK:
@@ -1091,7 +1091,7 @@ ustar_wr(ARCHD *arcn)
} else {
tty_warn(1, "Link name too long for ustar %s",
arcn->ln_name);
- return(1);
+ return 1;
}
}
break;
@@ -1110,7 +1110,7 @@ ustar_wr(ARCHD *arcn)
} else {
tty_warn(1, "File name too long for ustar %s",
arcn->name);
- return(1);
+ return 1;
}
}
@@ -1196,7 +1196,7 @@ ustar_wr(ARCHD *arcn)
sizeof(hd->size), 3)) {
tty_warn(1,"File is too long for ustar %s",
arcn->org_name);
- return(1);
+ return 1;
}
} else {
if (arcn->type == PAX_CTG)
@@ -1208,7 +1208,7 @@ ustar_wr(ARCHD *arcn)
sizeof(hd->size), 3)) {
tty_warn(1,"File is too long for ustar %s",
arcn->org_name);
- return(1);
+ return 1;
}
}
break;
@@ -1246,22 +1246,22 @@ ustar_wr(ARCHD *arcn)
sizeof(hd->chksum), 3))
return size_err("CHKSUM", arcn);
if (wr_rdbuf(hdblk, sizeof(HD_USTAR)) < 0)
- return(-1);
+ return -1;
if (wr_skip((off_t)(BLKMULT - sizeof(HD_USTAR))) < 0)
- return(-1);
+ return -1;
if (gnu_hack_string) {
int res = wr_rdbuf(gnu_hack_string, gnu_hack_len);
int pad = gnu_hack_len;
gnu_hack_string = NULL;
gnu_hack_len = 0;
if (res < 0)
- return(-1);
+ return -1;
if (wr_skip((off_t)(BLKMULT - (pad % BLKMULT))) < 0)
- return(-1);
+ return -1;
}
if ((arcn->type == PAX_CTG) || (arcn->type == PAX_REG))
- return(0);
- return(1);
+ return 0;
+ return 1;
}
/*
@@ -1419,7 +1419,7 @@ tar_gnutar_X_compat(path)
if (fp == NULL) {
tty_warn(1, "cannot open %s: %s", path,
strerror(errno));
- return(-1);
+ return -1;
}
while ((line = fgetln(fp, &len))) {