Re: Fwd: Bug#237426: mutt: Mutt segfaults when trying to attach from an inaccessible directory
On Fri, May 07, 2004 at 08:28:02PM +0900, TAKAHASHI Tamotsu wrote:
> Is it bad to delete one of two destroy_state(&state)?
> Both FreeBSD and Linux-glibc systems really segfaulted
> without his fix. And his suggestion really fixed the
> problem for both of them. Any side-effect or better way?
Even after patched, mutt segfaults when changing directory
after hitting unreadable directory.
I made another patch, which seems better than the previous one.
Could you review this one? (because I'm not a programmer.)
I haven't found any problem with this patch.
--- browser.c.old Wed Nov 5 18:41:31 2003
+++ browser.c Fri May 14 12:49:48 2004
@@ -944,21 +944,14 @@
{
if (S_ISDIR (st.st_mode))
{
- strfcpy (LastDir, buf, sizeof (LastDir));
destroy_state (&state);
- if (examine_directory (menu, &state, LastDir, prefix) == 0)
- {
- menu->current = 0;
- menu->top = 0;
- init_menu (&state, menu, title, sizeof (title), buffy);
- }
+ if (examine_directory (menu, &state, buf, prefix) == 0)
+ strfcpy (LastDir, buf, sizeof (LastDir));
else
- {
mutt_error _("Error scanning directory.");
- destroy_state (&state);
- mutt_menuDestroy (&menu);
- goto bail;
- }
+ menu->current = 0;
+ menu->top = 0;
+ init_menu (&state, menu, title, sizeof (title), buffy);
}
else
mutt_error (_("%s is not a directory."), buf);