lynx-dev
[Top][All Lists]
Advanced

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

Re: [Lynx-dev] Small patches for lynx2.8.9dev.16


From: Juan Manuel Guerrero
Subject: Re: [Lynx-dev] Small patches for lynx2.8.9dev.16
Date: Sun, 27 Aug 2017 22:19:55 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.13) Gecko/20101206 SUSE/3.1.7 Thunderbird/3.1.7

lynx.patch_for_289dev16-3 discribes a really serious issue but not
only for windows but also for all other DOS like file systems too,
thus I would suggest something like the small fix shown below.  It
shows a modification of the original patch.  It is is a classical
bug produced when the coding is posix centric.  It remains unclear
to me why stat is used instead of access.  Something like:
  access(dst, F_OK) != 0
is faster than having to compute stat for a file on windows or dos
AFAIK.  Do not get me wrong, for this application it will not really
matter.

Regards,
Juan M. Guerrero





diff -aprNU5 lynx2.8.9dev.16.orig/src/LYUtils.c lynx2.8.9dev.16/src/LYUtils.c
--- lynx2.8.9dev.16.orig/src/LYUtils.c  2017-08-27 00:17:50 +0000
+++ lynx2.8.9dev.16/src/LYUtils.c       2017-08-27 10:19:32 +0000
@@ -7102,13 +7102,13 @@ void LYAddHtmlSep0(char *path)
  * Rename a file
  */
 int LYRenameFile(char *src,
                char *dst)
 {
-#ifdef _WINDOWS
+#ifdef DOSPATH
     /*
-     * If dest_file exists prior to calling rename(), rename() will fail on 
Windows platforms.
+     * If dest_file exists prior to calling rename(), rename() will fail on 
Windows and DOS platforms.
      * 
https://www.securecoding.cert.org/confluence/display/c/FIO10-C.+Take+care+when+using+the+rename%28%29+function
      */
     struct stat st;
     if (stat(dst, &st) == 0) {
        unlink(dst);



reply via email to

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