components/bzip2/patches/bzip2.patch
author Gabriel Carrillo <gabriel.carrillo@oracle.com>
Mon, 25 Nov 2013 14:43:56 -0800
branchs11u1-sru
changeset 2830 3d056f49638d
parent 115 c360825c3a3f
permissions -rw-r--r--
Added tag 0.175.1.13.0.6.0, S11.1SRU13.6 for changeset 663f38ad85e5

--- 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 );