lynx-dev
[Top][All Lists]
Advanced

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

Re: lynx-dev REUSE_TEMPFILES problem (more)


From: Klaus Weide
Subject: Re: lynx-dev REUSE_TEMPFILES problem (more)
Date: Fri, 16 Jul 1999 11:00:41 -0500 (CDT)

On Fri, 16 Jul 1999, Leonid Pauzner wrote:

> 16-Jul-99 08:31 Klaus Weide wrote:
> DJGPP have no truncate() so the changes you propose below really
> equivalent to the present state when HAVE_TRUNCATE undefined (#else case).

No, it should not be equivalent - the difference is
   LYReopenTemp(fname)   vs.   LYOpenTemp(fname, suffix, mode).

LYReopenTemp appends - the name could be clearer.
LYOpenTemp should never append - it will assign a new filename.

Actually, my suggested change isn't good, it would still leave the
older versions hanging around...  (only until Lynx exits, I hope).
Some more change is needed for !HAVE_TRUNCATE, to get rid of the
previous version.  But..
how about just remove()ing the file instead of truncate(), for DOS,
(and then procede as in the truncate-was-successful case), could you
try that?

> The text still appended...

Have you tried it?  What I think you should have seen is not text
being appended, but multiple files piling up.  (like what you
saw at first)

> > We now have:
> 
> > #if HAVE_TRUNCATE
> >         if (truncate(fname, 0) != 0) {
> >             CTRACE(tfp, "... truncate(%s,0) failed: %s\n",
> >                    fname, LYStrerror(errno));
> >             return (LYOpenTemp(fname, suffix, mode));
> >         }
> > #endif
> >         return (LYReopenTemp(fname));
> 
> >   Please try this instead; let's see whether LYOpenTemp() will
> > do the right thing in DOS:
> 
> > #if HAVE_TRUNCATE
> >         if (truncate(fname, 0) == 0) {  /* success */
> >             return (LYReopenTemp(fname));
> >         } else {
> >             CTRACE(tfp, "... truncate(%s,0) failed: %s\n",
> >                    fname, LYStrerror(errno));
> >             return (LYOpenTemp(fname, suffix, mode));
> >         }
> > #else
> >       return (LYOpenTemp(fname, suffix, mode));
> > #endif


    Klaus



reply via email to

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