Ticket #2564: 8patch-1.5.6.dyc.source_stat

File 8patch-1.5.6.dyc.source_stat, 1.5 KB (added by marc_ozon@…, 20 years ago)

patch referred to in the bug description

Line 
1? mutt/build
2? mutt/stamp-h1
3Index: mutt/init.c
4===================================================================
5RCS file: /home/roessler/cvs/mutt/init.c,v
6retrieving revision 3.19
7diff -u -r3.19 init.c
8--- mutt/init.c 1 Feb 2004 18:00:16 -0000       3.19
9+++ mutt/init.c 6 Feb 2004 20:29:08 -0000
10@@ -1368,18 +1368,6 @@
11   char *linebuf = NULL;
12   size_t buflen;
13   pid_t pid;
14-  struct stat s;
15-
16-  if (stat (rcfile, &s) < 0)
17-  {
18-    snprintf (err->data, err->dsize, _("%s: stat: %s"), rcfile, strerror (errno));
19-    return (-1);
20-  }
21-  if (!S_ISREG (s.st_mode))
22-  {
23-    snprintf (err->data, err->dsize, _("%s: not a regular file"), rcfile);
24-    return (-1);
25-  }
26 
27   if ((f = mutt_open_read (rcfile, &pid)) == NULL)
28   {
29Index: mutt/muttlib.c
30===================================================================
31RCS file: /home/roessler/cvs/mutt/muttlib.c,v
32retrieving revision 3.18
33diff -u -r3.18 muttlib.c
34--- mutt/muttlib.c      1 Feb 2004 17:10:43 -0000       3.18
35+++ mutt/muttlib.c      6 Feb 2004 20:29:09 -0000
36@@ -1134,6 +1134,8 @@
37 FILE *mutt_open_read (const char *path, pid_t *thepid)
38 {
39   FILE *f;
40+  struct stat s;
41+
42   int len = mutt_strlen (path);
43 
44   if (path[len - 1] == '|')
45@@ -1149,6 +1151,16 @@
46   }
47   else
48   {
49+    if (stat (path, &s) < 0)
50+    {
51+      mutt_error (_("%s: stat: %s"), path, strerror (errno));
52+      return (NULL);
53+    }
54+    if (!S_ISREG (s.st_mode))
55+    {
56+      mutt_error (_("%s: not a regular file"), path);
57+      return (NULL);
58+    }
59     f = fopen (path, "r");
60     *thepid = -1;
61   }