From 6ce5111d955031ec46102b3c55241af72e9fb411 Mon Sep 17 00:00:00 2001 From: dillon Date: Sun, 28 Oct 2001 02:45:04 +0000 Subject: Various string fields for certain cpio types are 11 rather then 8 characters. Use quad conversion functions rather then long conversion where appropriate to handle the available range. Mainly fixes time_t but there was also a st_size ulong conversion in there that has to be quad or cpio cannot be used to copy files > 2G. MFC after: 1 day --- bin/pax/cpio.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'bin/pax/cpio.c') diff --git a/bin/pax/cpio.c b/bin/pax/cpio.c index ea8d3da..4bfc6f6 100644 --- a/bin/pax/cpio.c +++ b/bin/pax/cpio.c @@ -354,16 +354,21 @@ cpio_rd(arcn, buf) arcn->sb.st_nlink = (nlink_t)asc_ul(hd->c_nlink, sizeof(hd->c_nlink), OCT); arcn->sb.st_rdev = (dev_t)asc_ul(hd->c_rdev, sizeof(hd->c_rdev), OCT); +#ifdef NET2_STAT arcn->sb.st_mtime = (time_t)asc_ul(hd->c_mtime, sizeof(hd->c_mtime), OCT); +#else + arcn->sb.st_mtime = (time_t)asc_uqd(hd->c_mtime, sizeof(hd->c_mtime), + OCT); +#endif arcn->sb.st_ctime = arcn->sb.st_atime = arcn->sb.st_mtime; -# ifdef NET2_STAT +#ifdef NET2_STAT arcn->sb.st_size = (off_t)asc_ul(hd->c_filesize,sizeof(hd->c_filesize), OCT); -# else +#else arcn->sb.st_size = (off_t)asc_uqd(hd->c_filesize,sizeof(hd->c_filesize), OCT); -# endif +#endif /* * check name size and if valid, read in the name of this entry (name @@ -682,15 +687,19 @@ vcpio_rd(arcn, buf) arcn->sb.st_mode = (mode_t)asc_ul(hd->c_mode, sizeof(hd->c_mode), HEX); arcn->sb.st_uid = (uid_t)asc_ul(hd->c_uid, sizeof(hd->c_uid), HEX); arcn->sb.st_gid = (gid_t)asc_ul(hd->c_gid, sizeof(hd->c_gid), HEX); +#ifdef NET2_STAT arcn->sb.st_mtime = (time_t)asc_ul(hd->c_mtime,sizeof(hd->c_mtime),HEX); +#else + arcn->sb.st_mtime = (time_t)asc_uqd(hd->c_mtime,sizeof(hd->c_mtime),HEX); +#endif arcn->sb.st_ctime = arcn->sb.st_atime = arcn->sb.st_mtime; -# ifdef NET2_STAT +#ifdef NET2_STAT arcn->sb.st_size = (off_t)asc_ul(hd->c_filesize, sizeof(hd->c_filesize), HEX); -# else +#else arcn->sb.st_size = (off_t)asc_uqd(hd->c_filesize, sizeof(hd->c_filesize), HEX); -# endif +#endif arcn->sb.st_nlink = (nlink_t)asc_ul(hd->c_nlink, sizeof(hd->c_nlink), HEX); devmajor = (dev_t)asc_ul(hd->c_maj, sizeof(hd->c_maj), HEX); -- cgit v1.1