<<< Date Index >>>     <<< Thread Index >>>

Re: [BETTER PATCH] Re: Bug#237426: Mutt segfaults on unreadable directories



On Sat, May 15, 2004 at 01:01:50PM +0900, TAKAHASHI Tamotsu wrote:
> I gave up. Maybe we have to "goto bail;" when
> hitting an unreadable dir.

Or this one fixes it.

-- 
tamo
--- browser.c.old       Wed Nov  5 18:41:31 2003
+++ browser.c   Sat May 15 14:29:52 2004
@@ -944,21 +944,21 @@
          {
            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;
+               if (examine_directory (menu, &state, LastDir, prefix) == -1)
+               {
+                 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);