Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions FileCheck.xs
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ int _overload_ft_stat(pTHX_ Stat_t *stat, int *size) {
croak( "Overload::FileCheck::_check need to return an array ref" );

av_size = AvFILL(stat_array);
if ( av_size > 0 && av_size != ( STAT_T_MAX - 1 ) )
croak( "Overload::FileCheck::_check: Array should contain 13 elements" );
if ( av_size >= 0 && av_size != ( STAT_T_MAX - 1 ) )
croak( "Overload::FileCheck::_check: Array should contain 0 or 13 elements, got %d", av_size + 1 );

*size = av_size; /* store the av_size */
if ( av_size > 0 ) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Overload/FileCheck.pm
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ sub _check_from_stat {
},

# Existence and size (computed directly from cached stat)
e => sub { return CHECK_IS_NULL unless scalar @stat; _to_bool( $stat[ST_MODE] ) }, # file exists
e => sub { return CHECK_IS_NULL unless scalar @stat; CHECK_IS_TRUE }, # file exists (stat success implies existence)
s => sub { $stat[ST_SIZE] }, # nonzero size (returns bytes); fallback breaks on symlinks

# File type checks via mode bits (using @stat — follows symlinks)
Expand Down
4 changes: 2 additions & 2 deletions t/mock-all-from-stat_basic.t
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ __DATA__
-S 'my.socket'
!-s 'my.socket'

# a zero stat
!-e 'zero'
# a zero stat (stat succeeded with all-zero fields — file exists but has no type)
-e 'zero'
!-f 'zero'
!-l 'zero'
!-d 'zero'
Expand Down
Loading