summaryrefslogtreecommitdiffstats
path: root/bin/pax/cpio.c
diff options
context:
space:
mode:
authordillon <dillon@FreeBSD.org>2001-10-28 02:45:04 +0000
committerdillon <dillon@FreeBSD.org>2001-10-28 02:45:04 +0000
commit6ce5111d955031ec46102b3c55241af72e9fb411 (patch)
tree2d95881bdf0afca4876a73dd2a8be57a861f920a /bin/pax/cpio.c
parent5bb0a362e0fa4fcd82ab8c2b1490780699992218 (diff)
downloadFreeBSD-src-6ce5111d955031ec46102b3c55241af72e9fb411.zip
FreeBSD-src-6ce5111d955031ec46102b3c55241af72e9fb411.tar.gz
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
Diffstat (limited to 'bin/pax/cpio.c')
-rw-r--r--bin/pax/cpio.c21
1 files changed, 15 insertions, 6 deletions
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);
OpenPOWER on IntegriCloud