components/bzip2/patches/bzip2.patch
author Norm Jacobs <Norm.Jacobs@Oracle.COM>
Tue, 01 Mar 2011 14:19:15 -0800
changeset 115 c360825c3a3f
parent 61 components/bzip2/bzip2.patch@7684fe2a9eb5
permissions -rw-r--r--
7022166 userland patches should move to subdirs

--- bzip2-1.0.5/bzip2.c.orig	2008-11-28 05:47:09.537546000 -0800
+++ bzip2-1.0.5/bzip2.c	2008-11-28 05:50:37.075934000 -0800
@@ -221,6 +221,7 @@
 static void    copyFileName ( Char*, Char* );
 static void*   myMalloc     ( Int32 );
 static void    applySavedFileAttrToOutputFile ( IntNative fd );
+static void    applySavedTimeInfoToOutputFile ( Char *dstName );
 
 
 
@@ -368,6 +369,7 @@
    if (zStream != stdout) {
       Int32 fd = fileno ( zStream );
       if (fd < 0) goto errhandler_io;
+      applySavedTimeInfoToOutputFile ( outName ); 
       applySavedFileAttrToOutputFile ( fd );
       ret = fclose ( zStream );
       outputHandleJustInCase = NULL;
@@ -481,17 +483,18 @@
 
    closeok:
    if (ferror(zStream)) goto errhandler_io;
+   ret = fflush ( stream );
+   if (ret != 0) goto errhandler_io;
    if (stream != stdout) {
       Int32 fd = fileno ( stream );
       if (fd < 0) goto errhandler_io;
+      applySavedTimeInfoToOutputFile ( outName );
       applySavedFileAttrToOutputFile ( fd );
    }
    ret = fclose ( zStream );
    if (ret == EOF) goto errhandler_io;
 
    if (ferror(stream)) goto errhandler_io;
-   ret = fflush ( stream );
-   if (ret != 0) goto errhandler_io;
    if (stream != stdout) {
       ret = fclose ( stream );
       outputHandleJustInCase = NULL;
@@ -1297,7 +1300,6 @@
 
    /*--- If there was an I/O error, we won't get here. ---*/
    if ( srcMode == SM_F2F ) {
-      applySavedTimeInfoToOutputFile ( outName );
       deleteOutputOnInterrupt = False;
       if ( !keepInputFiles ) {
          IntNative retVal = remove ( inName );
@@ -1475,7 +1477,6 @@
    /*--- If there was an I/O error, we won't get here. ---*/
    if ( magicNumberOK ) {
       if ( srcMode == SM_F2F ) {
-         applySavedTimeInfoToOutputFile ( outName );
          deleteOutputOnInterrupt = False;
          if ( !keepInputFiles ) {
             IntNative retVal = remove ( inName );