diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2005-12-17 19:47:03 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2005-12-17 19:47:03 +0000 |
commit | 5407b158e70d5c6ceace181a12861e9d259bb7ee (patch) | |
tree | 4a12eb322335af3edb14880e26236d04c584d9e5 | |
parent | 840d6f0ac1530b4b3544f19962582331db245f30 (diff) |
Avoid sign extend when writing time stamps; fixes "tar: Ustar header
field is too small for foo" error messages when writing files with
negative time stamps on 64 bit archs.
ok millert@ deraadt@
-rw-r--r-- | bin/pax/tar.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/bin/pax/tar.c b/bin/pax/tar.c index eebc93194a9..19678c578dd 100644 --- a/bin/pax/tar.c +++ b/bin/pax/tar.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tar.c,v 1.39 2005/06/13 19:20:05 otto Exp $ */ +/* $OpenBSD: tar.c,v 1.40 2005/12/17 19:47:02 otto Exp $ */ /* $NetBSD: tar.c,v 1.5 1995/03/21 09:07:49 cgd Exp $ */ /*- @@ -38,7 +38,7 @@ #if 0 static const char sccsid[] = "@(#)tar.c 8.2 (Berkeley) 4/18/94"; #else -static const char rcsid[] = "$OpenBSD: tar.c,v 1.39 2005/06/13 19:20:05 otto Exp $"; +static const char rcsid[] = "$OpenBSD: tar.c,v 1.40 2005/12/17 19:47:02 otto Exp $"; #endif #endif /* not lint */ @@ -640,7 +640,7 @@ tar_wr(ARCHD *arcn) if (ul_oct((u_long)arcn->sb.st_mode, hd->mode, sizeof(hd->mode), 0) || ul_oct((u_long)arcn->sb.st_uid, hd->uid, sizeof(hd->uid), 0) || ul_oct((u_long)arcn->sb.st_gid, hd->gid, sizeof(hd->gid), 0) || - ul_oct((u_long)arcn->sb.st_mtime, hd->mtime, sizeof(hd->mtime), 1)) + ul_oct((u_long)(u_int)arcn->sb.st_mtime, hd->mtime, sizeof(hd->mtime), 1)) goto out; /* @@ -1067,7 +1067,7 @@ ustar_wr(ARCHD *arcn) goto out; } if (ul_oct((u_long)arcn->sb.st_mode, hd->mode, sizeof(hd->mode), 3) || - ul_oct((u_long)arcn->sb.st_mtime,hd->mtime,sizeof(hd->mtime),3)) + ul_oct((u_long)(u_int)arcn->sb.st_mtime,hd->mtime,sizeof(hd->mtime),3)) goto out; strncpy(hd->uname, name_uid(arcn->sb.st_uid, 0), sizeof(hd->uname)); strncpy(hd->gname, name_gid(arcn->sb.st_gid, 0), sizeof(hd->gname)); |