Compress-Bzip2
view release on metacpan or search on metacpan
bzlib-src/bzip2.c view on Meta::CPAN
892893894895896897898899900901902903904905906907908909910911912
setExit(3);
exit
(exitValue);
}
/*---------------------------------------------------*/
/*--- The main driver machinery ---*/
/*---------------------------------------------------*/
/* All rather crufty. The main problem is that input files
are
stat
()d multiple
times
before
use
. This should be
cleaned up.
*/
/*---------------------------------------------*/
static
void pad ( Char
*s
)
{
Int32 i;
if
( (Int32)strlen(s) >= longestFileName )
return
;
for
(i = 1; i <= longestFileName - (Int32)strlen(s); i++)
bzlib-src/bzip2.c view on Meta::CPAN
101210131014101510161017101810191020102110221023102410251026102710281029103010311032
into fileMetaInfo
before
starting to compress / decompress it,
because doing it afterwards means we get the wrong access
time
.
To complicate matters, in compress() and decompress() below, the
sequence of tests preceding the call to saveInputFileMetaInfo()
involves calling fileExists(), which in turn establishes its result
by attempting to fopen() the file, and
if
successful, immediately
fclose()ing it again. So we have to assume that the fopen() call
does not cause the access
time
field to be updated.
Reading of the man page
for
stat
() (man 2
stat
) on RedHat 7.2 seems
to imply that merely doing
open
() will not affect the access
time
.
Therefore we merely need to hope that the C library only does
open
() as a result of fopen(), and not any kind of
read
()-ahead
cleverness.
It sounds pretty fragile to me. Whether this carries across
robustly to arbitrary Unix-like platforms (or even works robustly
on this one, RedHat 7.2) is unknown to me. Nevertheless ...
*/
#if BZ_UNIX
lib/Compress/Bzip2.pm view on Meta::CPAN
353354355356357358359360361362363364365366367368369370371372373
STDERR
"Error: file $infile is not readable\n"
;
next
;
}
@statbuf
=
stat
_;
if
( !
@statbuf
) {
STDERR
"Error: failed to stat $infile: '$!'\n"
;
next
;
}
if
( !_check_stat(
$infile
, \
@statbuf
,
$opts
{f} ) ) {
STDERR
"Error: file $infile stat check fails: $bzerrno\n"
;
next
;
}
}
my
$outfile_exists
;
if
( !
$opts
{c} ) {
undef
$out
;
if
(
$opts
{d} ) {
$outfile
=
$infile
.
'.bz2'
;
( run in 0.256 second using v1.01-cache-2.11-cpan-0d8aa00de5b )