diff options
author | edwin <edwin@FreeBSD.org> | 2005-10-20 18:01:05 +0800 |
---|---|---|
committer | edwin <edwin@FreeBSD.org> | 2005-10-20 18:01:05 +0800 |
commit | e4cace2a25e3ce135382dec555e8f57dd239113a (patch) | |
tree | 46a4b36cb4101b4a589d7ccbf9bd74e435d7d03f | |
parent | dcfc4f8fe5145db4acdcf8d81e6f23236891ab6c (diff) | |
download | freebsd-ports-gnome-e4cace2a25e3ce135382dec555e8f57dd239113a.tar.gz freebsd-ports-gnome-e4cace2a25e3ce135382dec555e8f57dd239113a.tar.zst freebsd-ports-gnome-e4cace2a25e3ce135382dec555e8f57dd239113a.zip |
Add the missing parts from FreeBSD-SA-05:14.bzip2
See
ftp://ftp.freebsd.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-05:14.bzip2.asc
and the discussion on -ports about it.
Approved by: no reply from maintainer and pushed by members of so@
-rw-r--r-- | archivers/bzip2/Makefile | 2 | ||||
-rw-r--r-- | archivers/bzip2/files/patch-bzip2.c | 92 |
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 ); |