Skip to content

Commit

Permalink
mail can't write to mbox
Browse files Browse the repository at this point in the history
* When issuing quit command (q) I was seeing the error: Failed to write to /home/ranch/mbox: No such file or directory
* Something was wrong because the file did exist
* The error message printed $self->file but the path opened was $of, which had a prepended ">"
* Possibly this is a hangover from previously switching to 3-argument form of open()
  • Loading branch information
mknos authored Oct 3, 2023
1 parent b58e3a7 commit aa477e4
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions bin/mail
Original file line number Diff line number Diff line change
Expand Up @@ -425,13 +425,10 @@ sub write {
my $self=shift;
my $wa=shift;

$of=">" . $self->file;
if (exists $$wa{append} ) {
$of=">$of";
}
my $mode = exists $$wa{append} ? '>>' : '>';
my $alt_msg="\"" . $self->file . "\" ";
$alt_msg.=(-e $self->file)?"[Appended]":"[New File]";
if (! open(MBOX, '<', $of )) {
if (!open(MBOX, $mode, $self->file)) {
warn "Failed to write to ", $self->file, ": $!\n";
return;
}
Expand Down

0 comments on commit aa477e4

Please sign in to comment.