Authen-Quiz
view release on metacpan or search on metacpan
inc/File/Temp.pm view on Meta::CPAN
519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555# First checks to see if the directory is not owned by the
# current user or root. Then checks to see if anyone else
# can write to the directory and if so, checks to see if
# it has the sticky bit set
# Will not work on systems that do not support sticky bit
#Args: directory path to check
# Optionally: reference to scalar to contain error message
# Returns true if the path is safe and false otherwise.
# Returns undef if can not even run stat() on the path
# This routine based on version written by Tom Christiansen
# Presumably, by the time we actually attempt to create the
# file or directory in this directory, it may not be safe
# anymore... Have to run _is_safe directly after the open.
sub
_is_safe {
my
$path
=
shift
;
my
$err_ref
=
shift
;
# Stat path
my
@info
=
stat
(
$path
);
unless
(
scalar
(
@info
)) {
$$err_ref
=
"stat(path) returned no values"
;
return
0;
};
return
1
if
$^O eq
'VMS'
;
# owner delete control at file level
# Check to see whether owner is neither superuser (or a system uid) nor me
# Use the effective uid from the $> variable
# UID is in [4]
if
(
$info
[4] > File::Temp->top_system_uid() &&
$info
[4] != $>) {
Carp::cluck(
sprintf
"uid=$info[4] topuid=%s euid=$> path='$path'"
,
inc/File/Temp.pm view on Meta::CPAN
133913401341134213431344134513461347134813491350135113521353135413551356135713581359#line 1934
sub
unlink0 {
croak
'Usage: unlink0(filehandle, filename)'
unless
scalar
(
@_
) == 2;
# Read args
my
(
$fh
,
$path
) =
@_
;
cmpstat(
$fh
,
$path
) or
return
0;
# attempt remove the file (does not work on some platforms)
if
(_can_unlink_opened_file()) {
# return early (Without unlink) if we have been instructed to retain files.
return
1
if
$KEEP_ALL
;
# XXX: do *not* call this on a directory; possible race
# resulting in recursive removal
croak
"unlink0: $path has become a directory!"
if
-d
$path
;
inc/File/Temp.pm view on Meta::CPAN
137513761377137813791380138113821383138413851386138713881389139013911392139313941395
_deferred_unlink(
$fh
,
$path
, 0);
return
1;
}
}
#line 1999
sub
cmpstat {
croak
'Usage: cmpstat(filehandle, filename)'
unless
scalar
(
@_
) == 2;
# Read args
my
(
$fh
,
$path
) =
@_
;
warn
"Comparing stat\n"
if
$DEBUG
;
# Stat the filehandle - which may be closed if someone has manually
# closed the file. Can not turn off warnings without using $^W
inc/File/Temp.pm view on Meta::CPAN
14531454145514561457145814591460146114621463146414651466146714681469147014711472#line 2092
sub
unlink1 {
croak
'Usage: unlink1(filehandle, filename)'
unless
scalar
(
@_
) == 2;
# Read args
my
(
$fh
,
$path
) =
@_
;
cmpstat(
$fh
,
$path
) or
return
0;
# Close the file
close
(
$fh
) or
return
0;
# Make sure the file is writable (for windows)
_force_writable(
$path
);
# return early (without unlink) if we have been instructed to retain files.
return
1
if
$KEEP_ALL
;
inc/Module/Install.pm view on Meta::CPAN
58596061626364656667686970717273747576# If the script that is loading Module::Install is from the future,
# then make will detect this and cause it to re-run over and over
# again. This is bad. Rather than taking action to touch it (which
# is unreliable on some platforms and requires write permissions)
# for now we should catch this and refuse to run.
if
( -f $0 and (
stat
($0))[9] >
time
) {
die
<<
"END_DIE"
}
Your installer $0
has
a modification
time
in the future.
This is known to create infinite loops in make.
Please correct this, then run $0 again.
END_DIE
( run in 0.226 second using v1.01-cache-2.11-cpan-0f795438458 )