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: Jonathan Sergent
Subject: Re: LYNX-DEV Improvement on /tmp code fix?
Date: Sun, 13 Jul 1997 12:53:05 -0500

 ] 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.

...

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):

*** 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 = '.';
            }

... in all the appropriate places?  Just asking before I go do it.


-- 
Jonathan Sergent / address@hidden / address@hidden
;
; 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]