delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2003/01/31/11:58:42

From: sandmann AT clio DOT rice DOT edu (Charles Sandmann)
Message-Id: <10301311700.AA16268@clio.rice.edu>
Subject: Re: Uses of findfirst that eat LFN find handles
To: djgpp-workers AT delorie DOT com
Date: Fri, 31 Jan 2003 11:00:54 -0600 (CST)
In-Reply-To: <3E3A5444.377F597F@phekda.freeserve.co.uk> from "Richard Dawe" at Jan 31, 2003 10:47:32 AM
X-Mailer: ELM [version 2.5 PL2]
Mime-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> Some uses of findfirst will eat LFN find handles. See
> src/libc/posix/unistd/access.c for an example that doesn't.

findfirst and findnext internally try to do the right thing.
findfirst closes the handle itself if there are no wildcards;
findnext closes the handle when there are no more files found.

I'm not sure this always works in all cases, but ...

> Currently we have snippets of code like this in access.c, to clean up:
> 
>     /* Use _lfn_close_handle so we don't lose a handle.  */
>     if (findfirst(fixed_path, &ff, FA_DIREC) == 0)
>     {
>       if (strcmp(ff.lfn_magic, "LFN32") == 0)
>         _lfn_find_close(ff.lfn_handle);
>       return 0;
>     }

So this code may not be needed.  But someone would need to check.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019