]> granicus.if.org Git - mutt/commitdiff
Convert abort_noattach scan to use mutt_read_line().
authorKevin McCarthy <kevin@8t8.us>
Tue, 14 Aug 2018 01:22:58 +0000 (18:22 -0700)
committerKevin McCarthy <kevin@8t8.us>
Tue, 14 Aug 2018 01:33:34 +0000 (18:33 -0700)
I should have fixed this up before committing the patch.

send.c

diff --git a/send.c b/send.c
index 1a28605808f8d71ed86bb7879715b09ca1ffa242..316904b8e2c9ae590f1a8e6c6dde853a26cc9129 100644 (file)
--- a/send.c
+++ b/send.c
@@ -1136,7 +1136,8 @@ static int has_recips (ADDRESS *a)
 static int has_attach_keyword (char *filename)
 {
   int match = 0;
-  char buffer[LONG_STRING];
+  char *buf = NULL;
+  size_t blen = 0;
   FILE *fp;
 
   if ((fp = safe_fopen (filename, "r")) == NULL)
@@ -1145,15 +1146,16 @@ static int has_attach_keyword (char *filename)
     return 0;
   }
 
-  while (fgets (buffer, sizeof(buffer), fp) != NULL)
+  while ((buf = mutt_read_line (buf, &blen, fp, NULL, 0)) != NULL)
   {
-    if (regexec (AbortNoattachRegexp.rx, buffer, 0, NULL, 0) == 0)
+    if (regexec (AbortNoattachRegexp.rx, buf, 0, NULL, 0) == 0)
     {
       match = 1;
       break;
     }
   }
   safe_fclose (&fp);
+  FREE (&buf);
 
   return match;
 }