Fwd: Re: Shouldn't pclose() be used on FILE * created by popen() in libbalsa/pop.c? [jmcoopr@johncoop.MSHOME]



On 2001.07.24 17:20 John Merryweather Cooper wrote:
> Hmm...
> 
> I'm trying to stomp on a bug, and I think I've found it.
> 
> I use procmail to filter my mail with Balsa.  But the longer I allow
> Balsa
> to run the more "zombie" procmail processes I end up with--often several
> hundred!
> 
> I think this is happening because popen() is being used to start procmail
> at the end of a pipe, but fclose is being used to close the pipe. 
> Shouldn't this be pclose()?  My man pages on popen/pclose seem to  say
> so.
> 
> I should note that I'm running FreeBSD 4.3-STABLE, maybe this isn't a
> problem for Linux?
> 
> jmc
>

And the answer (on FreeBSD at least) is YES.  changing from fclose() to
pclose() eliminates the pesky procmail zombies.

See attached diff of libbalsa/pop3.c

jmc--- libbalsa/pop3.c	Fri Jul 13 01:45:04 2001
+++ libbalsa/pop3.c.new	Tue Jul 24 17:40:42 2001
@@ -507,7 +507,7 @@
 	
 	err = fetch_single_msg(s, msg, i, first_msg, msgs, &num_bytes, 
 			       tot_bytes, prog_cb);
-	if (fclose (msg) != 0 && err == POP_OK) err = POP_PROCMAIL_ERR;
+	if (pclose (msg) != 0 && err == POP_OK) err = POP_PROCMAIL_ERR;
 	
 	if (err != POP_OK)  break; /* the 'for' loop */
 	if (delete_on_server) delete_msg(s, i); /* ignore errors */




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]