diff --git a/bin/pax/cpio.c b/bin/pax/cpio.c index 1909f8eaf712..67602fa87455 100644 --- a/bin/pax/cpio.c +++ b/bin/pax/cpio.c @@ -390,7 +390,7 @@ cpio_wr(ARCHD *arcn) { HD_CPIO *hd; int nsz; - char hdblk[sizeof(HD_CPIO)]; + HD_CPIO hdblk; /* * check and repair truncated device and inode fields in the header @@ -400,7 +400,7 @@ cpio_wr(ARCHD *arcn) arcn->pad = 0L; nsz = arcn->nlen + 1; - hd = (HD_CPIO *)hdblk; + hd = &hdblk; if ((arcn->type != PAX_BLK) && (arcn->type != PAX_CHR)) arcn->sb.st_rdev = 0; @@ -467,7 +467,7 @@ cpio_wr(ARCHD *arcn) /* * write the file name to the archive */ - if ((wr_rdbuf(hdblk, (int)sizeof(HD_CPIO)) < 0) || + if ((wr_rdbuf((char *)&hdblk, (int)sizeof(HD_CPIO)) < 0) || (wr_rdbuf(arcn->name, nsz) < 0)) { paxwarn(1, "Unable to write cpio header for %s", arcn->org_name); return(-1); @@ -701,7 +701,7 @@ vcpio_wr(ARCHD *arcn) { HD_VCPIO *hd; unsigned int nsz; - char hdblk[sizeof(HD_VCPIO)]; + HD_VCPIO hdblk; /* * check and repair truncated device and inode fields in the cpio @@ -710,7 +710,7 @@ vcpio_wr(ARCHD *arcn) if (map_dev(arcn, (u_long)VCPIO_MASK, (u_long)VCPIO_MASK) < 0) return(-1); nsz = arcn->nlen + 1; - hd = (HD_VCPIO *)hdblk; + hd = &hdblk; if ((arcn->type != PAX_BLK) && (arcn->type != PAX_CHR)) arcn->sb.st_rdev = 0; @@ -802,7 +802,7 @@ vcpio_wr(ARCHD *arcn) /* * write the header, the file name and padding as required. */ - if ((wr_rdbuf(hdblk, (int)sizeof(HD_VCPIO)) < 0) || + if ((wr_rdbuf((char *)&hdblk, (int)sizeof(HD_VCPIO)) < 0) || (wr_rdbuf(arcn->name, (int)nsz) < 0) || (wr_skip((off_t)(VCPIO_PAD(sizeof(HD_VCPIO) + nsz))) < 0)) { paxwarn(1,"Could not write sv4cpio header for %s",arcn->org_name); @@ -1001,7 +1001,7 @@ bcpio_wr(ARCHD *arcn) { HD_BCPIO *hd; int nsz; - char hdblk[sizeof(HD_BCPIO)]; + HD_BCPIO hdblk; off_t t_offt; int t_int; time_t t_timet; @@ -1015,7 +1015,7 @@ bcpio_wr(ARCHD *arcn) if ((arcn->type != PAX_BLK) && (arcn->type != PAX_CHR)) arcn->sb.st_rdev = 0; - hd = (HD_BCPIO *)hdblk; + hd = &hdblk; switch(arcn->type) { case PAX_CTG: @@ -1115,7 +1115,7 @@ bcpio_wr(ARCHD *arcn) /* * write the header, the file name and padding as required. */ - if ((wr_rdbuf(hdblk, (int)sizeof(HD_BCPIO)) < 0) || + if ((wr_rdbuf((char *)&hdblk, (int)sizeof(HD_BCPIO)) < 0) || (wr_rdbuf(arcn->name, nsz) < 0) || (wr_skip((off_t)(BCPIO_PAD(sizeof(HD_BCPIO) + nsz))) < 0)) { paxwarn(1, "Could not write bcpio header for %s", arcn->org_name); diff --git a/bin/pax/tar.c b/bin/pax/tar.c index c23cd5b34f28..ab5bd3b12ad5 100644 --- a/bin/pax/tar.c +++ b/bin/pax/tar.c @@ -510,7 +510,7 @@ tar_wr(ARCHD *arcn) { HD_TAR *hd; int len; - char hdblk[sizeof(HD_TAR)]; + HD_TAR hdblk; /* * check for those file system types which tar cannot store @@ -569,7 +569,7 @@ tar_wr(ARCHD *arcn) * added after the file data (0 for all other types, as they only have * a header) */ - hd = (HD_TAR *)hdblk; + hd = &hdblk; l_strncpy(hd->name, arcn->name, sizeof(hd->name) - 1); hd->name[sizeof(hd->name) - 1] = '\0'; arcn->pad = 0; @@ -636,10 +636,10 @@ tar_wr(ARCHD *arcn) * 0 tells the caller to now write the file data, 1 says no data needs * to be written */ - if (ul_oct(tar_chksm(hdblk, sizeof(HD_TAR)), hd->chksum, + if (ul_oct(tar_chksm((char *)&hdblk, sizeof(HD_TAR)), hd->chksum, sizeof(hd->chksum), 3)) goto out; - if (wr_rdbuf(hdblk, sizeof(HD_TAR)) < 0) + if (wr_rdbuf((char *)&hdblk, sizeof(HD_TAR)) < 0) return(-1); if (wr_skip((off_t)(BLKMULT - sizeof(HD_TAR))) < 0) return(-1); @@ -898,7 +898,7 @@ ustar_wr(ARCHD *arcn) { HD_USTAR *hd; char *pt; - char hdblk[sizeof(HD_USTAR)]; + HD_USTAR hdblk; /* * check for those file system types ustar cannot store @@ -926,7 +926,7 @@ ustar_wr(ARCHD *arcn) paxwarn(1, "File name too long for ustar %s", arcn->name); return(1); } - hd = (HD_USTAR *)hdblk; + hd = &hdblk; arcn->pad = 0L; /* @@ -1044,10 +1044,10 @@ ustar_wr(ARCHD *arcn) * return 0 tells the caller to now write the file data, 1 says no data * needs to be written */ - if (ul_oct(tar_chksm(hdblk, sizeof(HD_USTAR)), hd->chksum, + if (ul_oct(tar_chksm((char *)&hdblk, sizeof(HD_USTAR)), hd->chksum, sizeof(hd->chksum), 3)) goto out; - if (wr_rdbuf(hdblk, sizeof(HD_USTAR)) < 0) + if (wr_rdbuf((char *)&hdblk, sizeof(HD_USTAR)) < 0) return(-1); if (wr_skip((off_t)(BLKMULT - sizeof(HD_USTAR))) < 0) return(-1);