diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2015-03-17 03:23:18 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2015-03-17 03:23:18 +0000 |
commit | 091f6b2cd2e14770746b4e99cc9058679c2403e1 (patch) | |
tree | 310d93118fbc3f8abac8dc17dd0c4c64802db540 /bin/pax/tar.c | |
parent | 232a2f05d9f71e64ae425a3947b98559ba6d177b (diff) |
Add PAX_IS_{REG,HARDLINK,LINK} macros to simply many file type tests
ok millert@
Diffstat (limited to 'bin/pax/tar.c')
-rw-r--r-- | bin/pax/tar.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/bin/pax/tar.c b/bin/pax/tar.c index 7878e2593e7..ba8b3e8ede8 100644 --- a/bin/pax/tar.c +++ b/bin/pax/tar.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tar.c,v 1.57 2015/03/15 19:47:27 guenther Exp $ */ +/* $OpenBSD: tar.c,v 1.58 2015/03/17 03:23:17 guenther Exp $ */ /* $NetBSD: tar.c,v 1.5 1995/03/21 09:07:49 cgd Exp $ */ /*- @@ -601,7 +601,7 @@ tar_wr(ARCHD *arcn) sizeof(arcn->ln_name)); if (ul_oct((u_long)0L, hd->size, sizeof(hd->size), 1)) goto out; - } else if ((arcn->type == PAX_HLK) || (arcn->type == PAX_HRG)) { + } else if (PAX_IS_HARDLINK(arcn->type)) { /* * no data follows this file, so no pad */ @@ -645,7 +645,7 @@ tar_wr(ARCHD *arcn) return(-1); if (wr_skip((off_t)(BLKMULT - sizeof(HD_TAR))) < 0) return(-1); - if ((arcn->type == PAX_CTG) || (arcn->type == PAX_REG)) + if (PAX_IS_REG(arcn->type)) return(0); return(1); @@ -952,8 +952,7 @@ ustar_wr(ARCHD *arcn) /* * check the length of the linkname */ - if (((arcn->type == PAX_SLK) || (arcn->type == PAX_HLK) || - (arcn->type == PAX_HRG)) && (arcn->ln_nlen > sizeof(hd->linkname))){ + if (PAX_IS_LINK(arcn->type) && (arcn->ln_nlen > sizeof(hd->linkname))) { paxwarn(1, "Link name too long for ustar %s", arcn->ln_name); return(1); } @@ -1112,7 +1111,7 @@ ustar_wr(ARCHD *arcn) return(-1); if (wr_skip((off_t)(BLKMULT - sizeof(HD_USTAR))) < 0) return(-1); - if ((arcn->type == PAX_CTG) || (arcn->type == PAX_REG)) + if (PAX_IS_REG(arcn->type)) return(0); return(1); |