[Top][All Lists]

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

[Nano-devel] Re: Speller file descriptor leaks.

From: Chris Allegretta
Subject: [Nano-devel] Re: Speller file descriptor leaks.
Date: Wed, 1 Jan 2003 10:22:14 -0800
User-agent: Mutt/

On Mon, Dec 16, 2002 at 04:15:57PM -0500, David Benbennick wrote:
> The new internal speller pipeline code leaks two file descriptors each
> time.  Here's one way to fix the problem:
> This doesn't help if there is an error with fork() or pipe().  Then nano
> will abort early, and leak some files and some processes.
> It seems to me that making this code watertight would be complicated.  I
> think a better solution is to call
> system("exec spell < \"[tempfile_name]\" | sort -f | uniq");

Hmm.  I just came up with a problem with both implementations. If 'sort' is
missing in the PATH, then the exit status will be zero (because uniq doesn't
care if it gets no input) but the spell checking in fact failed.  I thought we
could just check for read_buff_read == 0, but it would also be that if there
were no misspelled words(.  If your implementation addresses this somehow 
David, please let me know, but I couldn't get the patch to cooperate with the 
existing CVS tree.  Anyone have a thought on this?

Chris A
Chris Allegretta

"Share and Enjoy" - Douglas Adams, 1952 - 2001

reply via email to

[Prev in Thread] Current Thread [Next in Thread]