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
This commit is contained in:
Matthew Dillon 2001-10-28 02:45:04 +00:00
parent 6e63a1049a
commit 2ad45bbe3d

View File

@ -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);