fix a segfault introduced by some nasty const /o\
[apps/madmutt.git] / pattern.c
index 7f5fd51..c06f5f8 100644 (file)
--- a/pattern.c
+++ b/pattern.c
@@ -101,7 +101,7 @@ struct pattern_flags {
   '=', M_DUPLICATED, 0, NULL}, {
   '$', M_UNREFERENCED, 0, NULL}, {
   '*', M_REALNAME, 0, NULL}, {
-  0}
+  0, 0, 0, NULL}
 };
 
 static pattern_t *SearchPattern = NULL; /* current search pattern */
@@ -187,13 +187,13 @@ msg_search (CONTEXT *ctx, pattern_t* pat, int msgno)
           return (0);
         }
 
-        fseek (msg->fp, h->offset, 0);
+        fseeko (msg->fp, h->offset, 0);
         mutt_body_handler (h->content, &s);
       }
 
       fp = s.fpout;
       fflush (fp);
-      fseek (fp, 0, 0);
+      fseeko (fp, 0, 0);
       fstat (fileno (fp), &st);
       lng = (long) st.st_size;
     }
@@ -201,12 +201,12 @@ msg_search (CONTEXT *ctx, pattern_t* pat, int msgno)
       /* raw header / body */
       fp = msg->fp;
       if (pat->op != M_BODY) {
-        fseek (fp, h->offset, 0);
+        fseeko (fp, h->offset, 0);
         lng = h->content->offset - h->offset;
       }
       if (pat->op != M_HEADER) {
         if (pat->op == M_BODY)
-          fseek (fp, h->content->offset, 0);
+          fseeko (fp, h->content->offset, 0);
         lng += h->content->length;
       }
     }
@@ -1204,14 +1204,8 @@ int mutt_pattern_func (int op, char *prompt)
 
   strfcpy (buf, NONULL (Context->pattern), sizeof (buf));
   if (prompt || op != M_LIMIT)
-    if (mutt_get_field (prompt, buf, sizeof (buf), M_PATTERN | M_CLEAR) != 0)
+    if (mutt_get_field (prompt, buf, sizeof (buf), M_PATTERN | M_CLEAR) != 0 || !buf[0])
       return (-1);
-  if (!buf[0]) {
-    if (op == M_LIMIT)
-      strncpy (buf, "~A", sizeof (buf));
-    else
-      return (-1);
-  }
 
   mutt_message _("Compiling search pattern...");