both ILP32 and LP64.
ok millert@
-/* $OpenBSD: ar_io.c,v 1.56 2016/06/03 23:22:20 tedu Exp $ */
+/* $OpenBSD: ar_io.c,v 1.57 2016/08/14 18:30:33 guenther Exp $ */
/* $NetBSD: ar_io.c,v 1.5 1996/03/26 23:54:13 mrg Exp $ */
/*-
artyp = ioctl(arfd, MTIOCGET, &mb) ? ISCHR : ISTAPE;
else if (S_ISBLK(arsb.st_mode))
artyp = ISBLK;
- else if ((lseek(arfd, (off_t)0L, SEEK_CUR) == -1) && (errno == ESPIPE))
+ else if ((lseek(arfd, 0, SEEK_CUR) == -1) && (errno == ESPIPE))
artyp = ISPIPE;
else
artyp = ISREG;
* file, we must get rid of all the stuff after the current offset
* (it was not written by pax).
*/
- if (((cpos = lseek(arfd, (off_t)0L, SEEK_CUR)) < 0) ||
+ if (((cpos = lseek(arfd, 0, SEEK_CUR)) < 0) ||
(ftruncate(arfd, cpos) < 0)) {
syswarn(1, errno, "Unable to truncate archive file");
return(-1);
* in size by forcing the runt record to next archive
* volume
*/
- if ((cpos = lseek(arfd, (off_t)0L, SEEK_CUR)) < 0)
+ if ((cpos = lseek(arfd, 0, SEEK_CUR)) < 0)
break;
- cpos -= (off_t)res;
+ cpos -= res;
if (ftruncate(arfd, cpos) < 0)
break;
res = lstrval = 0;
io_ok = 0;
if (((fsbz = arsb.st_blksize) <= 0) || (artyp != ISREG))
fsbz = BLKMULT;
- if ((cpos = lseek(arfd, (off_t)0L, SEEK_CUR)) < 0)
+ if ((cpos = lseek(arfd, 0, SEEK_CUR)) < 0)
break;
- mpos = fsbz - (cpos % (off_t)fsbz);
+ mpos = fsbz - (cpos % fsbz);
if (lseek(arfd, mpos, SEEK_CUR) < 0)
break;
lstrval = 1;
/*
* figure out where we are in the archive
*/
- if ((cpos = lseek(arfd, (off_t)0L, SEEK_CUR)) >= 0) {
+ if ((cpos = lseek(arfd, 0, SEEK_CUR)) >= 0) {
/*
* we can be asked to move farther than there are bytes in this
* volume, if so, just go to file end and let normal buf_fill()
* may not even have the ability to lseek() in any direction).
* First we figure out where we are in the archive.
*/
- if ((cpos = lseek(arfd, (off_t)0L, SEEK_CUR)) < 0) {
+ if ((cpos = lseek(arfd, 0, SEEK_CUR)) < 0) {
syswarn(1, errno,
"Unable to obtain current archive byte offset");
lstrval = -1;
* previous volume and continue our movement backwards from
* there.
*/
- if ((cpos -= sksz) < (off_t)0L) {
+ if ((cpos -= sksz) < 0) {
if (arvol > 1) {
/*
* this should never happen
lstrval = -1;
return(-1);
}
- cpos = (off_t)0L;
+ cpos = 0;
}
if (lseek(arfd, cpos, SEEK_SET) < 0) {
syswarn(1, errno, "Unable to seek archive backwards");
-/* $OpenBSD: buf_subs.c,v 1.27 2015/03/19 05:14:24 guenther Exp $ */
+/* $OpenBSD: buf_subs.c,v 1.28 2016/08/14 18:30:33 guenther Exp $ */
/* $NetBSD: buf_subs.c,v 1.5 1995/03/21 09:07:08 cgd Exp $ */
/*-
skcnt += bufend - bufpt;
if ((cnt = (skcnt/blksz) * blksz) < skcnt)
cnt += blksz;
- if (ar_rev((off_t)cnt) < 0)
+ if (ar_rev(cnt) < 0)
goto out;
/*
goto out;
bufpt += res;
}
- if (ar_rev((off_t)(bufpt - buf)) < 0)
+ if (ar_rev(bufpt - buf) < 0)
goto out;
bufpt = buf + cnt;
bufend = buf + blksz;
* what is left we have to read (which may be the whole thing if
* ar_fow() told us the device can only read to skip records);
*/
- while (res > 0L) {
+ while (res > 0) {
cnt = bufend - bufpt;
/*
* if the read fails, we will have to resync
/*
* loop while there is more padding to add
*/
- while (skcnt > 0L) {
+ while (skcnt > 0) {
cnt = bufend - bufpt;
if ((cnt <= 0) && ((cnt = buf_flush(blksz)) < 0))
return(-1);
/*
* while there are more bytes to write
*/
- while (size > 0L) {
+ while (size > 0) {
cnt = bufend - bufpt;
if ((cnt <= 0) && ((cnt = buf_flush(blksz)) < 0)) {
*left = size;
*/
if (res < 0)
syswarn(1, errno, "Read fault on %s", arcn->org_name);
- else if (size != 0L)
+ else if (size != 0)
paxwarn(1, "File changed size during read %s", arcn->org_name);
else if (fstat(ifd, &sb) < 0)
syswarn(1, errno, "Failed stat on %s", arcn->org_name);
} else
syswarn(0,errno,"Unable to obtain block size for file %s",fnm);
rem = sz;
- *left = 0L;
+ *left = 0;
/*
* Copy the archive to the file the number of bytes specified. We have
* to assume that we want to recover file holes as none of the archive
* formats can record the location of file holes.
*/
- while (size > 0L) {
+ while (size > 0) {
cnt = bufend - bufpt;
/*
* if we get a read error, we do not want to skip, as we may
* written. just closing with the file offset moved forward may not put
* a hole at the end of the file.
*/
- if (isem && (arcn->sb.st_size > 0L))
+ if (isem && (arcn->sb.st_size > 0))
file_flush(ofd, fnm, isem);
/*
* if we failed from archive read, we do not want to skip
*/
- if ((size > 0L) && (*left == 0L))
+ if ((size > 0) && (*left == 0))
return(-1);
/*
* some formats record a crc on file data. If so, then we compare the
* calculated crc to the crc stored in the archive
*/
- if (docrc && (size == 0L) && (arcn->crc != crc))
+ if (docrc && (size == 0) && (arcn->crc != crc))
paxwarn(1,"Actual crc does not match expected crc %s",arcn->name);
return(0);
}
cp_file(ARCHD *arcn, int fd1, int fd2)
{
int cnt;
- off_t cpcnt = 0L;
+ off_t cpcnt = 0;
int res = 0;
char *fnm = arcn->name;
int no_hole = 0;
* written. just closing with the file offset moved forward may not put
* a hole at the end of the file.
*/
- if (!no_hole && isem && (arcn->sb.st_size > 0L))
+ if (!no_hole && isem && (arcn->sb.st_size > 0))
file_flush(fd2, fnm, isem);
}
-/* $OpenBSD: cpio.c,v 1.28 2016/08/14 04:47:52 guenther Exp $ */
+/* $OpenBSD: cpio.c,v 1.29 2016/08/14 18:30:33 guenther Exp $ */
/* $NetBSD: cpio.c,v 1.5 1995/03/21 09:07:13 cgd Exp $ */
/*-
* byte oriented cpio (posix) does not have padding! extract the octal
* ascii fields from the header
*/
- arcn->pad = 0L;
+ arcn->pad = 0;
arcn->sb.st_dev = (dev_t)asc_ul(hd->c_dev, sizeof(hd->c_dev), OCT);
arcn->sb.st_ino = (ino_t)asc_ul(hd->c_ino, sizeof(hd->c_ino), OCT);
arcn->sb.st_mode = (mode_t)asc_ul(hd->c_mode, sizeof(hd->c_mode), OCT);
off_t
cpio_endrd(void)
{
- return((off_t)(sizeof(HD_CPIO) + sizeof(TRAILER)));
+ return sizeof(HD_CPIO) + sizeof(TRAILER);
}
/*
/*
* check and repair truncated device and inode fields in the header
*/
- if (map_dev(arcn, (u_long)CPIO_MASK, (u_long)CPIO_MASK) < 0)
+ if (map_dev(arcn, CPIO_MASK, CPIO_MASK) < 0)
return(-1);
- arcn->pad = 0L;
+ arcn->pad = 0;
nsz = arcn->nlen + 1;
hd = (HD_CPIO *)hdblk;
if ((arcn->type != PAX_BLK) && (arcn->type != PAX_CHR))
/*
* set data size to hold link name
*/
- if (ul_asc((u_long)arcn->ln_nlen, hd->c_filesize,
+ if (ul_asc(arcn->ln_nlen, hd->c_filesize,
sizeof(hd->c_filesize), OCT))
goto out;
break;
/*
* all other file types have no file data
*/
- if (ul_asc((u_long)0, hd->c_filesize, sizeof(hd->c_filesize),
- OCT))
+ if (ul_asc(0, hd->c_filesize, sizeof(hd->c_filesize), OCT))
goto out;
break;
}
/*
* copy the values to the header using octal ascii
*/
- if (ul_asc((u_long)MAGIC, hd->c_magic, sizeof(hd->c_magic), OCT) ||
- ul_asc((u_long)arcn->sb.st_dev, hd->c_dev, sizeof(hd->c_dev),
- OCT) ||
- ul_asc((u_long)arcn->sb.st_ino, hd->c_ino, sizeof(hd->c_ino),
- OCT) ||
- ul_asc((u_long)arcn->sb.st_mode, hd->c_mode, sizeof(hd->c_mode),
- OCT) ||
- ul_asc((u_long)arcn->sb.st_uid, hd->c_uid, sizeof(hd->c_uid),
- OCT) ||
- ul_asc((u_long)arcn->sb.st_gid, hd->c_gid, sizeof(hd->c_gid),
- OCT) ||
- ul_asc((u_long)arcn->sb.st_nlink, hd->c_nlink, sizeof(hd->c_nlink),
- OCT) ||
- ul_asc((u_long)arcn->sb.st_rdev, hd->c_rdev, sizeof(hd->c_rdev),
- OCT) ||
+ if (ul_asc(MAGIC, hd->c_magic, sizeof(hd->c_magic), OCT) ||
+ ul_asc(arcn->sb.st_dev, hd->c_dev, sizeof(hd->c_dev), OCT) ||
+ ul_asc(arcn->sb.st_ino, hd->c_ino, sizeof(hd->c_ino), OCT) ||
+ ul_asc(arcn->sb.st_mode, hd->c_mode, sizeof(hd->c_mode), OCT) ||
+ ul_asc(arcn->sb.st_uid, hd->c_uid, sizeof(hd->c_uid), OCT) ||
+ ul_asc(arcn->sb.st_gid, hd->c_gid, sizeof(hd->c_gid), OCT) ||
+ ul_asc(arcn->sb.st_nlink, hd->c_nlink, sizeof(hd->c_nlink), OCT) ||
+ ul_asc(arcn->sb.st_rdev, hd->c_rdev, sizeof(hd->c_rdev), OCT) ||
ull_asc(arcn->sb.st_mtime < 0 ? 0 : arcn->sb.st_mtime, hd->c_mtime,
sizeof(hd->c_mtime), OCT) ||
- ul_asc((u_long)nsz, hd->c_namesize, sizeof(hd->c_namesize), OCT))
+ ul_asc(nsz, hd->c_namesize, sizeof(hd->c_namesize), OCT))
goto out;
/*
}
hd = (HD_VCPIO *)buf;
- arcn->pad = 0L;
+ arcn->pad = 0;
/*
* extract the hex ascii fields from the header
/*
* skip padding. header + filename is aligned to 4 byte boundaries
*/
- if (rd_skip((off_t)(VCPIO_PAD(sizeof(HD_VCPIO) + nsz))) < 0)
+ if (rd_skip(VCPIO_PAD(sizeof(HD_VCPIO) + nsz)) < 0)
return(-1);
/*
* read in the link name and skip over the padding
*/
if ((rd_ln_nm(arcn) < 0) ||
- (rd_skip((off_t)(VCPIO_PAD(arcn->sb.st_size))) < 0))
+ (rd_skip(VCPIO_PAD(arcn->sb.st_size)) < 0))
return(-1);
/*
off_t
vcpio_endrd(void)
{
- return((off_t)(sizeof(HD_VCPIO) + sizeof(TRAILER) +
- (VCPIO_PAD(sizeof(HD_VCPIO) + sizeof(TRAILER)))));
+ return sizeof(HD_VCPIO) + sizeof(TRAILER) +
+ (VCPIO_PAD(sizeof(HD_VCPIO) + sizeof(TRAILER)));
}
/*
* check and repair truncated device and inode fields in the cpio
* header
*/
- if (map_dev(arcn, (u_long)VCPIO_MASK, (u_long)VCPIO_MASK) < 0)
+ if (map_dev(arcn, VCPIO_MASK, VCPIO_MASK) < 0)
return(-1);
nsz = arcn->nlen + 1;
hd = (HD_VCPIO *)hdblk;
* file data crc's, and the crc if needed.
*/
if (docrc) {
- if (ul_asc((u_long)VCMAGIC, hd->c_magic, sizeof(hd->c_magic),
- OCT) ||
- ul_asc((u_long)arcn->crc,hd->c_chksum,sizeof(hd->c_chksum),
- HEX))
+ if (ul_asc(VCMAGIC, hd->c_magic, sizeof(hd->c_magic), OCT) ||
+ ul_asc(arcn->crc,hd->c_chksum,sizeof(hd->c_chksum), HEX))
goto out;
} else {
- if (ul_asc((u_long)VMAGIC, hd->c_magic, sizeof(hd->c_magic),
- OCT) ||
- ul_asc((u_long)0L, hd->c_chksum, sizeof(hd->c_chksum),HEX))
+ if (ul_asc(VMAGIC, hd->c_magic, sizeof(hd->c_magic), OCT) ||
+ ul_asc(0, hd->c_chksum, sizeof(hd->c_chksum),HEX))
goto out;
}
* no file data for the caller to process, the file data has
* the size of the link
*/
- arcn->pad = 0L;
- if (ul_asc((u_long)arcn->ln_nlen, hd->c_filesize,
+ arcn->pad = 0;
+ if (ul_asc(arcn->ln_nlen, hd->c_filesize,
sizeof(hd->c_filesize), HEX))
goto out;
break;
/*
* no file data for the caller to process
*/
- arcn->pad = 0L;
- if (ul_asc((u_long)0L, hd->c_filesize, sizeof(hd->c_filesize),
- HEX))
+ arcn->pad = 0;
+ if (ul_asc(0, hd->c_filesize, sizeof(hd->c_filesize), HEX))
goto out;
break;
}
/*
* set the other fields in the header
*/
- if (ul_asc((u_long)arcn->sb.st_ino, hd->c_ino, sizeof(hd->c_ino),
- HEX) ||
- ul_asc((u_long)arcn->sb.st_mode, hd->c_mode, sizeof(hd->c_mode),
- HEX) ||
- ul_asc((u_long)arcn->sb.st_uid, hd->c_uid, sizeof(hd->c_uid),
- HEX) ||
- ul_asc((u_long)arcn->sb.st_gid, hd->c_gid, sizeof(hd->c_gid),
- HEX) ||
+ if (ul_asc(arcn->sb.st_ino, hd->c_ino, sizeof(hd->c_ino), HEX) ||
+ ul_asc(arcn->sb.st_mode, hd->c_mode, sizeof(hd->c_mode), HEX) ||
+ ul_asc(arcn->sb.st_uid, hd->c_uid, sizeof(hd->c_uid), HEX) ||
+ ul_asc(arcn->sb.st_gid, hd->c_gid, sizeof(hd->c_gid), HEX) ||
ul_asc(arcn->sb.st_mtime < 0 ? 0 : arcn->sb.st_mtime, hd->c_mtime,
sizeof(hd->c_mtime), HEX) ||
- ul_asc((u_long)arcn->sb.st_nlink, hd->c_nlink, sizeof(hd->c_nlink),
- HEX) ||
- ul_asc((u_long)MAJOR(arcn->sb.st_dev),hd->c_maj, sizeof(hd->c_maj),
- HEX) ||
- ul_asc((u_long)MINOR(arcn->sb.st_dev),hd->c_min, sizeof(hd->c_min),
- HEX) ||
- ul_asc((u_long)MAJOR(arcn->sb.st_rdev),hd->c_rmaj,sizeof(hd->c_maj),
- HEX) ||
- ul_asc((u_long)MINOR(arcn->sb.st_rdev),hd->c_rmin,sizeof(hd->c_min),
- HEX) ||
- ul_asc((u_long)nsz, hd->c_namesize, sizeof(hd->c_namesize), HEX))
+ ul_asc(arcn->sb.st_nlink, hd->c_nlink, sizeof(hd->c_nlink), HEX) ||
+ ul_asc(MAJOR(arcn->sb.st_dev),hd->c_maj, sizeof(hd->c_maj), HEX) ||
+ ul_asc(MINOR(arcn->sb.st_dev),hd->c_min, sizeof(hd->c_min), HEX) ||
+ ul_asc(MAJOR(arcn->sb.st_rdev),hd->c_rmaj,sizeof(hd->c_maj), HEX) ||
+ ul_asc(MINOR(arcn->sb.st_rdev),hd->c_rmin,sizeof(hd->c_min), HEX) ||
+ ul_asc(nsz, hd->c_namesize, sizeof(hd->c_namesize), HEX))
goto out;
/*
*/
if ((wr_rdbuf(hdblk, (int)sizeof(HD_VCPIO)) < 0) ||
(wr_rdbuf(arcn->name, (int)nsz) < 0) ||
- (wr_skip((off_t)(VCPIO_PAD(sizeof(HD_VCPIO) + nsz))) < 0)) {
+ (wr_skip(VCPIO_PAD(sizeof(HD_VCPIO) + nsz)) < 0)) {
paxwarn(1,"Could not write sv4cpio header for %s",arcn->org_name);
return(-1);
}
* write the link name, tell the caller we are done.
*/
if ((wr_rdbuf(arcn->ln_name, arcn->ln_nlen) < 0) ||
- (wr_skip((off_t)(VCPIO_PAD(arcn->ln_nlen))) < 0)) {
+ (wr_skip(VCPIO_PAD(arcn->ln_nlen)) < 0)) {
paxwarn(1,"Could not write sv4cpio link name for %s",
arcn->org_name);
return(-1);
if (bcpio_id(buf, sizeof(HD_BCPIO)) < 0)
return(-1);
- arcn->pad = 0L;
+ arcn->pad = 0;
hd = (HD_BCPIO *)buf;
if (swp_head) {
/*
/*
* header + file name are aligned to 2 byte boundaries, skip if needed
*/
- if (rd_skip((off_t)(BCPIO_PAD(sizeof(HD_BCPIO) + nsz))) < 0)
+ if (rd_skip(BCPIO_PAD(sizeof(HD_BCPIO) + nsz)) < 0)
return(-1);
/*
}
if ((rd_ln_nm(arcn) < 0) ||
- (rd_skip((off_t)(BCPIO_PAD(arcn->sb.st_size))) < 0))
+ (rd_skip(BCPIO_PAD(arcn->sb.st_size)) < 0))
return(-1);
/*
off_t
bcpio_endrd(void)
{
- return((off_t)(sizeof(HD_BCPIO) + sizeof(TRAILER) +
- (BCPIO_PAD(sizeof(HD_BCPIO) + sizeof(TRAILER)))));
+ return sizeof(HD_BCPIO) + sizeof(TRAILER) +
+ (BCPIO_PAD(sizeof(HD_BCPIO) + sizeof(TRAILER)));
}
/*
* check and repair truncated device and inode fields in the cpio
* header
*/
- if (map_dev(arcn, (u_long)BCPIO_MASK, (u_long)BCPIO_MASK) < 0)
+ if (map_dev(arcn, BCPIO_MASK, BCPIO_MASK) < 0)
return(-1);
if ((arcn->type != PAX_BLK) && (arcn->type != PAX_CHR))
* no file data for the caller to process, the file data has
* the size of the link
*/
- arcn->pad = 0L;
+ arcn->pad = 0;
hd->h_filesize_1[0] = CHR_WR_0(arcn->ln_nlen);
hd->h_filesize_1[1] = CHR_WR_1(arcn->ln_nlen);
hd->h_filesize_2[0] = CHR_WR_2(arcn->ln_nlen);
/*
* no file data for the caller to process
*/
- arcn->pad = 0L;
+ arcn->pad = 0;
hd->h_filesize_1[0] = (char)0;
hd->h_filesize_1[1] = (char)0;
hd->h_filesize_2[0] = (char)0;
*/
if ((wr_rdbuf(hdblk, (int)sizeof(HD_BCPIO)) < 0) ||
(wr_rdbuf(arcn->name, nsz) < 0) ||
- (wr_skip((off_t)(BCPIO_PAD(sizeof(HD_BCPIO) + nsz))) < 0)) {
+ (wr_skip(BCPIO_PAD(sizeof(HD_BCPIO) + nsz)) < 0)) {
paxwarn(1, "Could not write bcpio header for %s", arcn->org_name);
return(-1);
}
* write the link name, tell the caller we are done.
*/
if ((wr_rdbuf(arcn->ln_name, arcn->ln_nlen) < 0) ||
- (wr_skip((off_t)(BCPIO_PAD(arcn->ln_nlen))) < 0)) {
+ (wr_skip(BCPIO_PAD(arcn->ln_nlen)) < 0)) {
paxwarn(1,"Could not write bcpio link name for %s",arcn->org_name);
return(-1);
}
-/* $OpenBSD: file_subs.c,v 1.48 2016/02/16 04:30:07 guenther Exp $ */
+/* $OpenBSD: file_subs.c,v 1.49 2016/08/14 18:30:33 guenther Exp $ */
/* $NetBSD: file_subs.c,v 1.4 1995/03/21 09:07:18 cgd Exp $ */
/*-
* skip, buf is empty so far
*/
if (fd > -1 &&
- lseek(fd, (off_t)wcnt, SEEK_CUR) < 0) {
+ lseek(fd, wcnt, SEEK_CUR) < 0) {
syswarn(1,errno,"File seek on %s",
name);
return(-1);
/*
* move back one byte and write a zero
*/
- if (lseek(fd, (off_t)-1, SEEK_CUR) < 0) {
+ if (lseek(fd, -1, SEEK_CUR) < 0) {
syswarn(1, errno, "Failed seek on file %s", fname);
return;
}
{
int i;
int res;
- off_t cpcnt = 0L;
- u_long size;
+ off_t cpcnt = 0;
+ size_t size;
u_int32_t crc = 0;
char tbuf[FILEBLK];
struct stat sb;
/*
* hmm, no fd, should never happen. well no crc then.
*/
- arcn->crc = 0L;
+ arcn->crc = 0;
return(0);
}
- if ((size = (u_long)arcn->sb.st_blksize) > (u_long)sizeof(tbuf))
- size = (u_long)sizeof(tbuf);
+ if ((size = arcn->sb.st_blksize) > sizeof(tbuf))
+ size = sizeof(tbuf);
/*
* read all the bytes we think that there are in the file. If the user
syswarn(1, errno, "Failed stat on %s", arcn->org_name);
else if (timespeccmp(&arcn->sb.st_mtim, &sb.st_mtim, !=))
paxwarn(1, "File %s was modified during read", arcn->org_name);
- else if (lseek(fd, (off_t)0L, SEEK_SET) < 0)
+ else if (lseek(fd, 0, SEEK_SET) < 0)
syswarn(1, errno, "File rewind failed on: %s", arcn->org_name);
else {
arcn->crc = crc;
-/* $OpenBSD: tables.c,v 1.47 2015/03/19 05:14:24 guenther Exp $ */
+/* $OpenBSD: tables.c,v 1.48 2016/08/14 18:30:33 guenther Exp $ */
/* $NetBSD: tables.c,v 1.4 1995/03/21 09:07:45 cgd Exp $ */
/*-
* add the name at the end of the scratch file, saving the
* offset. add the file to the head of the hash chain
*/
- if ((pt->seek = lseek(ffd, (off_t)0, SEEK_END)) >= 0) {
+ if ((pt->seek = lseek(ffd, 0, SEEK_END)) >= 0) {
if (write(ffd, arcn->name, namelen) == namelen) {
pt->mtim = arcn->sb.st_mtim;
pt->namelen = namelen;
-/* $OpenBSD: tar.c,v 1.60 2016/08/14 04:47:52 guenther Exp $ */
+/* $OpenBSD: tar.c,v 1.61 2016/08/14 18:30:33 guenther Exp $ */
/* $NetBSD: tar.c,v 1.5 1995/03/21 09:07:49 cgd Exp $ */
/*-
int
tar_endwr(void)
{
- return(wr_skip((off_t)(NULLCNT*BLKMULT)));
+ return wr_skip(NULLCNT * BLKMULT);
}
/*
off_t
tar_endrd(void)
{
- return((off_t)(NULLCNT*BLKMULT));
+ return NULLCNT * BLKMULT;
}
/*
*/
hd->linkflag = AREGTYPE;
hd->name[len-1] = '/';
- if (ul_oct((u_long)0L, hd->size, sizeof(hd->size), 1))
+ if (ul_oct(0, hd->size, sizeof(hd->size), 1))
goto out;
} else if (arcn->type == PAX_SLK) {
/*
hd->linkflag = SYMTYPE;
fieldcpy(hd->linkname, sizeof(hd->linkname), arcn->ln_name,
sizeof(arcn->ln_name));
- if (ul_oct((u_long)0L, hd->size, sizeof(hd->size), 1))
+ if (ul_oct(0, hd->size, sizeof(hd->size), 1))
goto out;
} else if (PAX_IS_HARDLINK(arcn->type)) {
/*
hd->linkflag = LNKTYPE;
fieldcpy(hd->linkname, sizeof(hd->linkname), arcn->ln_name,
sizeof(arcn->ln_name));
- if (ul_oct((u_long)0L, hd->size, sizeof(hd->size), 1))
+ if (ul_oct(0, hd->size, sizeof(hd->size), 1))
goto out;
} else {
/*
/*
* copy those fields that are independent of the type
*/
- if (ul_oct((u_long)arcn->sb.st_mode, hd->mode, sizeof(hd->mode), 0) ||
+ if (ul_oct(arcn->sb.st_mode, hd->mode, sizeof(hd->mode), 0) ||
ull_oct(arcn->sb.st_mtime < 0 ? 0 : arcn->sb.st_mtime, hd->mtime,
sizeof(hd->mtime), 1) ||
- ul_oct((u_long)arcn->sb.st_uid, hd->uid, sizeof(hd->uid), 0) ||
- ul_oct((u_long)arcn->sb.st_gid, hd->gid, sizeof(hd->gid), 0))
+ ul_oct(arcn->sb.st_uid, hd->uid, sizeof(hd->uid), 0) ||
+ ul_oct(arcn->sb.st_gid, hd->gid, sizeof(hd->gid), 0))
goto out;
/*
goto out;
if (wr_rdbuf(hdblk, sizeof(HD_TAR)) < 0)
return(-1);
- if (wr_skip((off_t)(BLKMULT - sizeof(HD_TAR))) < 0)
+ if (wr_skip(BLKMULT - sizeof(HD_TAR)) < 0)
return(-1);
if (PAX_IS_REG(arcn->type))
return(0);
*/
memset(hdblk, 0, sizeof(hdblk));
hd = (HD_USTAR *)hdblk;
- arcn->pad = 0L;
+ arcn->pad = 0;
/*
* split the name, or zero out the prefix
switch (arcn->type) {
case PAX_DIR:
hd->typeflag = DIRTYPE;
- if (ul_oct((u_long)0L, hd->size, sizeof(hd->size), 3))
+ if (ul_oct(0, hd->size, sizeof(hd->size), 3))
goto out;
break;
case PAX_CHR:
hd->typeflag = CHRTYPE;
else
hd->typeflag = BLKTYPE;
- if (ul_oct((u_long)MAJOR(arcn->sb.st_rdev), hd->devmajor,
+ if (ul_oct(MAJOR(arcn->sb.st_rdev), hd->devmajor,
sizeof(hd->devmajor), 3) ||
- ul_oct((u_long)MINOR(arcn->sb.st_rdev), hd->devminor,
+ ul_oct(MINOR(arcn->sb.st_rdev), hd->devminor,
sizeof(hd->devminor), 3) ||
- ul_oct((u_long)0L, hd->size, sizeof(hd->size), 3))
+ ul_oct(0, hd->size, sizeof(hd->size), 3))
goto out;
break;
case PAX_FIF:
hd->typeflag = FIFOTYPE;
- if (ul_oct((u_long)0L, hd->size, sizeof(hd->size), 3))
+ if (ul_oct(0, hd->size, sizeof(hd->size), 3))
goto out;
break;
case PAX_SLK:
hd->typeflag = LNKTYPE;
fieldcpy(hd->linkname, sizeof(hd->linkname), arcn->ln_name,
sizeof(arcn->ln_name));
- if (ul_oct((u_long)0L, hd->size, sizeof(hd->size), 3))
+ if (ul_oct(0, hd->size, sizeof(hd->size), 3))
goto out;
break;
case PAX_REG:
* set the remaining fields. Some versions want all 16 bits of mode
* we better humor them (they really do not meet spec though)....
*/
- if (ul_oct((u_long)arcn->sb.st_uid, hd->uid, sizeof(hd->uid), 3)) {
+ if (ul_oct(arcn->sb.st_uid, hd->uid, sizeof(hd->uid), 3)) {
if (uid_nobody == 0) {
if (uid_name("nobody", &uid_nobody) == -1)
goto out;
"Ustar header field is too small for uid %lu, "
"using nobody", (u_long)arcn->sb.st_uid);
}
- if (ul_oct((u_long)uid_nobody, hd->uid, sizeof(hd->uid), 3))
+ if (ul_oct(uid_nobody, hd->uid, sizeof(hd->uid), 3))
goto out;
}
- if (ul_oct((u_long)arcn->sb.st_gid, hd->gid, sizeof(hd->gid), 3)) {
+ if (ul_oct(arcn->sb.st_gid, hd->gid, sizeof(hd->gid), 3)) {
if (gid_nobody == 0) {
if (gid_name("nobody", &gid_nobody) == -1)
goto out;
"Ustar header field is too small for gid %lu, "
"using nobody", (u_long)arcn->sb.st_gid);
}
- if (ul_oct((u_long)gid_nobody, hd->gid, sizeof(hd->gid), 3))
+ if (ul_oct(gid_nobody, hd->gid, sizeof(hd->gid), 3))
goto out;
}
if (ull_oct(arcn->sb.st_mtime < 0 ? 0 : arcn->sb.st_mtime, hd->mtime,
sizeof(hd->mtime), 3) ||
- ul_oct((u_long)arcn->sb.st_mode, hd->mode, sizeof(hd->mode), 3))
+ ul_oct(arcn->sb.st_mode, hd->mode, sizeof(hd->mode), 3))
goto out;
if (!Nflag) {
strncpy(hd->uname, name_uid(arcn->sb.st_uid, 0), sizeof(hd->uname));
goto out;
if (wr_rdbuf(hdblk, sizeof(HD_USTAR)) < 0)
return(-1);
- if (wr_skip((off_t)(BLKMULT - sizeof(HD_USTAR))) < 0)
+ if (wr_skip(BLKMULT - sizeof(HD_USTAR)) < 0)
return(-1);
if (PAX_IS_REG(arcn->type))
return(0);