Репозитории ALT
S: | 1.0.8-alt2 |
5.1: | 1.0.6-alt1 |
4.1: | 1.0.6-alt0.M40.1 |
4.0: | 1.0.6-alt0.M40.1 |
+updates: | 1.0.5-alt2 |
3.0: | 1.0.3-alt5 |
Группа :: Архивирование/Сжатие
Пакет: bzip2
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: bzip2-1.0.3-alt-chmod-chown.patch
Скачать
Скачать
diff -uprk.orig bzip2-1.0.3.orig/bzip2.c bzip2-1.0.3/bzip2.c
--- bzip2-1.0.3.orig/bzip2.c 2005-05-16 12:55:40 +0000
+++ bzip2-1.0.3/bzip2.c 2005-05-16 12:56:36 +0000
@@ -459,12 +459,6 @@ void compressStream ( FILE *stream, FILE
if (ferror(zStream)) goto errhandler_io;
ret = fflush ( zStream );
if (ret == EOF) goto errhandler_io;
- if (zStream != stdout) {
- ret = fclose ( zStream );
- outputHandleJustInCase = NULL;
- if (ret == EOF) goto errhandler_io;
- }
- outputHandleJustInCase = NULL;
if (ferror(stream)) goto errhandler_io;
ret = fclose ( stream );
if (ret == EOF) goto errhandler_io;
@@ -578,12 +572,6 @@ Bool uncompressStream ( FILE *zStream, F
if (ferror(stream)) goto errhandler_io;
ret = fflush ( stream );
if (ret != 0) goto errhandler_io;
- if (stream != stdout) {
- ret = fclose ( stream );
- outputHandleJustInCase = NULL;
- if (ret == EOF) goto errhandler_io;
- }
- outputHandleJustInCase = NULL;
if (verbosity >= 2) fprintf ( stderr, "\n " );
return True;
@@ -616,7 +604,6 @@ Bool uncompressStream ( FILE *zStream, F
compressedStreamEOF();
case BZ_DATA_ERROR_MAGIC:
if (zStream != stdin) fclose(zStream);
- if (stream != stdout) fclose(stream);
if (streamNo == 1) {
return False;
} else {
@@ -1132,7 +1119,7 @@ void saveInputFileMetaInfo ( Char *srcNa
static
-void applySavedMetaInfoToOutputFile ( const Char* dstName )
+void applySavedMetaInfoToOutputFile ( const Char* dstName, FILE *stream )
{
# if BZ_UNIX
IntNative retVal;
@@ -1141,13 +1128,13 @@ void applySavedMetaInfoToOutputFile ( Ch
uTimBuf.actime = fileMetaInfo.st_atime;
uTimBuf.modtime = fileMetaInfo.st_mtime;
- retVal = chmod ( dstName, fileMetaInfo.st_mode );
+ retVal = fchmod ( fileno ( stream ), fileMetaInfo.st_mode );
ERROR_IF_NOT_ZERO ( retVal );
retVal = utime ( dstName, &uTimBuf );
ERROR_IF_NOT_ZERO ( retVal );
- retVal = chown ( dstName, fileMetaInfo.st_uid, fileMetaInfo.st_gid );
+ retVal = fchown ( fileno ( stream ), fileMetaInfo.st_uid, fileMetaInfo.st_gid );
/* chown() will in many cases return with EPERM, which can
be safely ignored.
*/
@@ -1369,11 +1356,10 @@ void compress ( Char *name )
outputHandleJustInCase = outStr;
deleteOutputOnInterrupt = True;
compressStream ( inStr, outStr );
- outputHandleJustInCase = NULL;
/*--- If there was an I/O error, we won't get here. ---*/
if ( srcMode == SM_F2F ) {
- applySavedMetaInfoToOutputFile ( outName );
+ applySavedMetaInfoToOutputFile ( outName, outStr );
deleteOutputOnInterrupt = False;
if ( !keepInputFiles ) {
IntNative retVal = remove ( inName );
@@ -1381,6 +1367,9 @@ void compress ( Char *name )
}
}
+ outputHandleJustInCase = NULL;
+ if (outStr != stdout)
+ ERROR_IF_EOF ( fclose ( outStr ) );
deleteOutputOnInterrupt = False;
}
@@ -1546,12 +1535,11 @@ void uncompress ( Char *name )
outputHandleJustInCase = outStr;
deleteOutputOnInterrupt = True;
magicNumberOK = uncompressStream ( inStr, outStr );
- outputHandleJustInCase = NULL;
/*--- If there was an I/O error, we won't get here. ---*/
if ( magicNumberOK ) {
if ( srcMode == SM_F2F ) {
- applySavedMetaInfoToOutputFile ( outName );
+ applySavedMetaInfoToOutputFile ( outName, outStr );
deleteOutputOnInterrupt = False;
if ( !keepInputFiles ) {
IntNative retVal = remove ( inName );
@@ -1566,6 +1554,10 @@ void uncompress ( Char *name )
ERROR_IF_NOT_ZERO ( retVal );
}
}
+
+ outputHandleJustInCase = NULL;
+ if (outStr != stdout)
+ ERROR_IF_EOF ( fclose ( outStr ) );
deleteOutputOnInterrupt = False;
if ( magicNumberOK ) {