Fix to check empty mail files before opening

This commit is contained in:
Ilia Ross
2026-05-30 21:22:38 +02:00
parent 034d0a09ce
commit 1eb4eb85a7

View File

@@ -2706,12 +2706,12 @@ sub read_mail_file
my ($file, $headersonly) = @_;
# Open and read the mail file
local @st = stat($file);
return undef if (@st && !$st[7]);
&open_as_mail_user(MAIL, $file) || return undef;
my $mail = &read_mail_fh(MAIL, 0, $headersonly);
close(MAIL);
local @st = stat($file);
return undef if (@st && !$st[7]);
$mail->{'file'} = $file;
$mail->{'size'} = $st[7];
$mail->{'time'} = $st[9];