char full[_POSIX_PATH_MAX];
char *s;
+ if (safe_fclose (&msg->fp) != 0)
+ return -1;
+
/* extract the subdir */
s = strrchr (msg->path, '/') + 1;
strfcpy (subdir, s, 4);
char path[_POSIX_PATH_MAX];
char tmp[16];
+ if (safe_fclose (&msg->fp) != 0)
+ return -1;
+
if ((dirp = opendir (ctx->path)) == NULL)
{
mutt_perror (ctx->path);
MESSAGE *dest;
int rc;
+ short restore = 1;
char oldpath[_POSIX_PATH_MAX];
char newpath[_POSIX_PATH_MAX];
char partpath[_POSIX_PATH_MAX];
mx_close_message (&dest);
if (rc == 0)
+ {
unlink (oldpath);
+ restore = 0;
+ }
/*
* Try to move the new message to the old place.
mutt_str_replace (&h->path, partpath);
}
}
- else mx_close_message (&dest);
+ else
+ mx_close_message (&dest);
- if (rc == -1)
+ if (rc == -1 && restore)
{
h->content->offset = old_body_offset;
h->content->length = old_body_length;
case M_MAILDIR:
{
- if ((r = safe_fclose (&msg->fp)) == 0)
- r = maildir_commit_message (ctx, msg, NULL);
+ r = maildir_commit_message (ctx, msg, NULL);
break;
}
case M_MH:
{
- if ((r = safe_fclose (&msg->fp)) == 0)
- r = mh_commit_message (ctx, msg, NULL);
+ r = mh_commit_message (ctx, msg, NULL);
break;
}
}