[GRASS5] Re: [GRASSLIST:4564] Re: .tmp files

Eric G. Miller egm2 at jps.net
Tue Sep 24 12:08:46 EDT 2002


On Tue, Sep 24, 2002 at 04:57:52PM +0200, Bernhard Reiter wrote:

> I don't think a daemon is a good idea.
> I'm not that familiar with GRASS' way of doing locking, but I 
> suggest to add some meta information to the file, just as a lock
> and this should contain the expected time to live.

I have to agree here.  I think a daemon is a heavy handed solution
and there isn't any good way to know how long temp files should
live.

Perhaps a variant on G_tempfile(), that works like tmpfile(), for
those cases where the name doesn't need to get passed around, and
once created, the file is kept open until no longer needed.

FILE *
G_tempfile2()
{
   char *name = G_tempfile();
   FILE *tmp  = fopen (name, "wb+");
   unlink (name);
   return tmp;
}

(course, a little error checking is needed...)

-- 
begin 664 .signature
M<F5L;&E-("Y'(&-I<D4@/G1E;BYS<&I`,FUG93P)"`@("`@("`@("`@("`@(
M"`@("`@("`@("`@("`@("`A%<FEC($<N($UI;&QE<B`\96=M,D!J<',N;F5T
"/@H`
`
end




More information about the grass-dev mailing list