lynx-dev
[Top][All Lists]
Advanced

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

Re: LYNX-DEV Improvement on /tmp code fix?


From: Klaus Weide
Subject: Re: LYNX-DEV Improvement on /tmp code fix?
Date: Sun, 13 Jul 1997 13:54:53 -0500 (CDT)

On Sun, 13 Jul 1997, Jonathan Sergent wrote:

>  ] Look at the functions in HTFWriter.c to see what may actually happen,
>  ] for example HTSaveToFile.
>  ] Your code would create, just to be sure, three different temp files
>  ] *and keep them around* till lynx exits.  But the function which has
>  ] called tempname() may use neither of LYnnnnnTMP.html, LYnnnnnTMP.txt,
>  ] or LYnnnnnTMP.bin, but (for example) LYnnnnnTMP.gif instead, depending
>  ] on what is being downloaded...
>  ] so all that trouble you are going to doesn't buy you anything more
>  ] (in that case) than is already there.
> 
> (well, it does if you're downloading HTML or text! :-)  I knew about,
> but forgot about, the said musical extension business.

In many places only a .html file is used, but not in all.  (And you'd
have to go through all the places where a tempname()-originated file
is opened for writing, to check whether ther's a "musical extension".

Hope you're having fun with this :)  I had mine earlier...

> ...
> 
> So do we think it's more appropriate to change the way tempname() gets
> called everywhere (add an extra parameter or something), or to make 
> changes like this (for HTSaveAndExecute, untested):
>
 [ moved below ] 
> 
> ... in all the appropriate places?  Just asking before I go do it.

I don't know.  Try to figure out which would be less of a mess.

Don't forget the ifdefing that will be reuqired for non-unix-like
systems.

For your diff below, consider whether HTFileSuffix() could return
(e.g.) ".html" even if the type was not "text/html", and what your
code would do in that case.

> *** HTFWriter.c.orig  Sun Jul 13 12:39:35 1997
> --- HTFWriter.c       Sun Jul 13 12:39:49 1997
> ***************
> *** 392,397 ****
> --- 392,398 ----
>       char *cp;
>       HTStream* me;
>       FILE *fp = NULL;
> +     int fd = -1;
>   
>       if (traversal) {
>           LYCancelledFetch = TRUE;
> ***************
> *** 478,488 ****
>                *  It's not one of the suffixes checked for a
>                *  spoof in tempname(), so check it now. - FM
>                */
> !             if ((fp = fopen(fnam, "r")) != NULL) {
> !                 fclose(fp);
> !                 fp = NULL;
>                   goto SaveAndExecute_tempname;
> !             }
>           } else {
>               *cp = '.';
>           }
> --- 479,490 ----
>                *  It's not one of the suffixes checked for a
>                *  spoof in tempname(), so check it now. - FM
>                */
> !             if ((fd = open(fnam, O_CREAT|O_RDWR|O_EXCL, 0600)) == -1) {
> !                 close(fd);
> !                 fd = -1;
>                   goto SaveAndExecute_tempname;
> !             } else 
> !                 fp = fdopen(fd, "r");
>           } else {
>               *cp = '.';
>           }

  Klaus

;
; To UNSUBSCRIBE:  Send a mail message to address@hidden
;                  with "unsubscribe lynx-dev" (without the
;                  quotation marks) on a line by itself.
;

reply via email to

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