Skip to content
Snippets Groups Projects
Commit bf90fd82 authored by Andy Yates's avatar Andy Yates
Browse files

Return 1 if we unlinked the file. Otherwise return 0

parent acb18be4
No related branches found
No related tags found
No related merge requests found
......@@ -131,15 +131,17 @@ sub production_name {
# Closes file handle, and deletes the file stub if no data was written to
# the file handle (using tell). We can also only close a file handle and unlink
# the data if it was open otherwise we just ignore it
# Returns success if we managed to close/delete the file
# Returns success if we managed to delete the file
sub tidy_file_handle {
my ($self, $fh, $path) = @_;
if($fh->opened()) {
my $unlink = ($fh->tell() == 0) ? 1 : 0;
$fh->close();
unlink($path) if -f $path && $unlink;
return 1;
if($unlink && -f $path) {
unlink($path);
return 1;
}
}
return 0;
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment