fetchmail-friends
[Top] [All Lists]

Re: Now with 5.9.6.. Was: [fetchmail]fetchmail <= 5.9.5 crashing

2001-12-25 03:42:05
On Tue, Dec 25, 2001 at 07:32:10 -0200, hmh(_at_)debian(_dot_)org wrote:
Eric, I also examined this patch, and I could not find a place where
deletions was properly initialized at all. Maybe I am dense at C, but at the
very least the current code is non-obvious if it is initializing deletions
IMHO...  (the fact that other .c file use 'deletions' which is NOT the same
variable even if imap.c's is a static int global, does not help either).

Static variables in C-programs which are not explicitly initialized
are initialized to 0 when the program is started. See for example
paragraph 6.7.8#10 in the C99 standard for details. (It is not
something new in C99).

See attached patch for something I am trying right now, and which (if it is
right) makes the code a easier to follow IMHO

Index: imap.c
===================================================================
RCS file: /home/cvs/debian/fetchmail/imap.c,v
retrieving revision 1.19
diff -u -r1.19 imap.c
--- imap.c    9 Nov 2001 12:15:45 -0000       1.19
+++ imap.c    24 Dec 2001 23:46:02 -0000
@@ -29,8 +29,9 @@
 #define IMAP4                0       /* IMAP4 rev 0, RFC1730 */
 #define IMAP4rev1    1       /* IMAP4 rev 1, RFC2060 */
 
-static int count, unseen, deletions, imap_version, preauth; 
-static int expunged, expunge_period, saved_timeout;
+static int count, unseen, deletions = 0;
+static int expunged, expunge_period, saved_timeout = 0;
+static int imap_version, preauth;

All of these variable are initialized to 0, also those without
explicit initialization.