components/bzip2/patches/bzip2.patch
changeset 115 c360825c3a3f
parent 61 7684fe2a9eb5
equal deleted inserted replaced
114:6cc95ec7b1bb 115:c360825c3a3f
       
     1 --- bzip2-1.0.5/bzip2.c.orig	2008-11-28 05:47:09.537546000 -0800
       
     2 +++ bzip2-1.0.5/bzip2.c	2008-11-28 05:50:37.075934000 -0800
       
     3 @@ -221,6 +221,7 @@
       
     4  static void    copyFileName ( Char*, Char* );
       
     5  static void*   myMalloc     ( Int32 );
       
     6  static void    applySavedFileAttrToOutputFile ( IntNative fd );
       
     7 +static void    applySavedTimeInfoToOutputFile ( Char *dstName );
       
     8  
       
     9  
       
    10  
       
    11 @@ -368,6 +369,7 @@
       
    12     if (zStream != stdout) {
       
    13        Int32 fd = fileno ( zStream );
       
    14        if (fd < 0) goto errhandler_io;
       
    15 +      applySavedTimeInfoToOutputFile ( outName ); 
       
    16        applySavedFileAttrToOutputFile ( fd );
       
    17        ret = fclose ( zStream );
       
    18        outputHandleJustInCase = NULL;
       
    19 @@ -481,17 +483,18 @@
       
    20  
       
    21     closeok:
       
    22     if (ferror(zStream)) goto errhandler_io;
       
    23 +   ret = fflush ( stream );
       
    24 +   if (ret != 0) goto errhandler_io;
       
    25     if (stream != stdout) {
       
    26        Int32 fd = fileno ( stream );
       
    27        if (fd < 0) goto errhandler_io;
       
    28 +      applySavedTimeInfoToOutputFile ( outName );
       
    29        applySavedFileAttrToOutputFile ( fd );
       
    30     }
       
    31     ret = fclose ( zStream );
       
    32     if (ret == EOF) goto errhandler_io;
       
    33  
       
    34     if (ferror(stream)) goto errhandler_io;
       
    35 -   ret = fflush ( stream );
       
    36 -   if (ret != 0) goto errhandler_io;
       
    37     if (stream != stdout) {
       
    38        ret = fclose ( stream );
       
    39        outputHandleJustInCase = NULL;
       
    40 @@ -1297,7 +1300,6 @@
       
    41  
       
    42     /*--- If there was an I/O error, we won't get here. ---*/
       
    43     if ( srcMode == SM_F2F ) {
       
    44 -      applySavedTimeInfoToOutputFile ( outName );
       
    45        deleteOutputOnInterrupt = False;
       
    46        if ( !keepInputFiles ) {
       
    47           IntNative retVal = remove ( inName );
       
    48 @@ -1475,7 +1477,6 @@
       
    49     /*--- If there was an I/O error, we won't get here. ---*/
       
    50     if ( magicNumberOK ) {
       
    51        if ( srcMode == SM_F2F ) {
       
    52 -         applySavedTimeInfoToOutputFile ( outName );
       
    53           deleteOutputOnInterrupt = False;
       
    54           if ( !keepInputFiles ) {
       
    55              IntNative retVal = remove ( inName );