aboutsummaryrefslogtreecommitdiff
path: root/archivers
diff options
context:
space:
mode:
authorEdwin Groothuis <edwin@FreeBSD.org>2005-10-20 10:01:05 +0000
committerEdwin Groothuis <edwin@FreeBSD.org>2005-10-20 10:01:05 +0000
commit92588a2f7a0859788545b708549132120f5a10e0 (patch)
treea1966f26e446820773f13b595bc8924b64348d08 /archivers
parent26b7449a68c94d747c9cecde7327d718a008fa5c (diff)
downloadports-92588a2f7a0859788545b708549132120f5a10e0.tar.gz
ports-92588a2f7a0859788545b708549132120f5a10e0.zip
Notes
Diffstat (limited to 'archivers')
-rw-r--r--archivers/bzip2/Makefile2
-rw-r--r--archivers/bzip2/files/patch-bzip2.c92
2 files changed, 94 insertions, 0 deletions
diff --git a/archivers/bzip2/Makefile b/archivers/bzip2/Makefile
index b3b084074f07..c1d1bb43f4e2 100644
--- a/archivers/bzip2/Makefile
+++ b/archivers/bzip2/Makefile
@@ -8,6 +8,7 @@
PORTNAME= bzip2
PORTVERSION= 1.0.3
+PORTREVISION= 1
CATEGORIES= archivers
MASTER_SITES= http://www.bzip.org/${PORTVERSION}/
@@ -15,6 +16,7 @@ MAINTAINER= jharris@widomaker.com
COMMENT= A block-sorting file compressor
INSTALLS_SHLIB= yes
+PATCH_STRIP= -p3
MAN1= bzip2.1 bzgrep.1 bzmore.1
MLINKS= bzip2.1 bunzip2.1 bzip2.1 bzcat.1 bzip2.1 bz2cat.1 \
diff --git a/archivers/bzip2/files/patch-bzip2.c b/archivers/bzip2/files/patch-bzip2.c
new file mode 100644
index 000000000000..dcf2cdb42987
--- /dev/null
+++ b/archivers/bzip2/files/patch-bzip2.c
@@ -0,0 +1,92 @@
+--- bzip2.c.orig Wed Feb 16 03:25:35 2005
++++ bzip2.c Sun Oct 16 09:47:40 2005
+@@ -312,6 +312,7 @@
+
+ static void copyFileName ( Char*, Char* );
+ static void* myMalloc ( Int32 );
++static int applySavedFileAttrToOutputFile ( int fd );
+
+
+
+@@ -457,6 +458,10 @@
+ ret = fflush ( zStream );
+ if (ret == EOF) goto errhandler_io;
+ if (zStream != stdout) {
++ int fd = fileno ( zStream );
++ if (fd < 0) goto errhandler_io;
++ ret = applySavedFileAttrToOutputFile ( fd );
++ if (ret != 0) goto errhandler_io;
+ ret = fclose ( zStream );
+ outputHandleJustInCase = NULL;
+ if (ret == EOF) goto errhandler_io;
+@@ -569,6 +574,12 @@
+
+ closeok:
+ if (ferror(zStream)) goto errhandler_io;
++ if ( stream != stdout) {
++ int fd = fileno ( stream );
++ if (fd < 0) goto errhandler_io;
++ ret = applySavedFileAttrToOutputFile ( fd );
++ if (ret != 0) goto errhandler_io;
++ }
+ ret = fclose ( zStream );
+ if (ret == EOF) goto errhandler_io;
+
+@@ -1129,7 +1140,7 @@
+
+
+ static
+-void applySavedMetaInfoToOutputFile ( Char *dstName )
++void applySavedTimeInfoToOutputFile ( Char *dstName )
+ {
+ # if BZ_UNIX
+ IntNative retVal;
+@@ -1138,16 +1149,26 @@
+ uTimBuf.actime = fileMetaInfo.st_atime;
+ uTimBuf.modtime = fileMetaInfo.st_mtime;
+
+- retVal = chmod ( dstName, fileMetaInfo.st_mode );
+- ERROR_IF_NOT_ZERO ( retVal );
+-
+ retVal = utime ( dstName, &uTimBuf );
+ ERROR_IF_NOT_ZERO ( retVal );
++# endif
++}
++
++static
++int applySavedFileAttrToOutputFile ( int fd )
++{
++# if BZ_UNIX
++ IntNative retVal;
++
++ retVal = fchmod ( fd, fileMetaInfo.st_mode );
++ if (retVal != 0)
++ return retVal;
+
+- retVal = chown ( dstName, fileMetaInfo.st_uid, fileMetaInfo.st_gid );
++ (void) fchown ( fd, fileMetaInfo.st_uid, fileMetaInfo.st_gid );
+ /* chown() will in many cases return with EPERM, which can
+ be safely ignored.
+ */
++ return 0;
+ # endif
+ }
+
+@@ -1370,7 +1391,7 @@
+
+ /*--- If there was an I/O error, we won't get here. ---*/
+ if ( srcMode == SM_F2F ) {
+- applySavedMetaInfoToOutputFile ( outName );
++ applySavedTimeInfoToOutputFile ( outName );
+ deleteOutputOnInterrupt = False;
+ if ( !keepInputFiles ) {
+ IntNative retVal = remove ( inName );
+@@ -1548,7 +1569,7 @@
+ /*--- If there was an I/O error, we won't get here. ---*/
+ if ( magicNumberOK ) {
+ if ( srcMode == SM_F2F ) {
+- applySavedMetaInfoToOutputFile ( outName );
++ applySavedTimeInfoToOutputFile ( outName );
+ deleteOutputOnInterrupt = False;
+ if ( !keepInputFiles ) {
+ IntNative retVal = remove ( inName );