Hello!  Looks like behavior changed between 2.8.4 and 2.8.5 when doing 
listings of local directories ("lynx .")

In 2.8.4, symlinks would be sorted based on their _destination_ file 
type (symlinks to dirs go into "Subdirectories", symlinks to files go to 
"Files").

It looks like during cleanups the top-level "stat" turned into an 
"lstat", which breaks the S_ISDIR test that would correctly sort the 
symlink into the Subdirectories list.

I have delayed the "lstat" call, and instead, use just plain "stat" 
again at the top, and only do an "lstat" call once we get to determining 
if the file really is a symlink or not.

Patch attached...

-- 
Kees Cook                                            @outflux.net
--- lynx-2.8.5/WWW/Library/Implementation/HTFile.c.orig 2004-03-11 23:00:54.000000000 
-0800
+++ lynx-2.8.5/WWW/Library/Implementation/HTFile.c      2004-03-11 23:02:59.000000000 
-0800
@@ -207,6 +207,7 @@ PRIVATE void LYListFmtParse ARGS5(
        char *datestr;
 #ifdef S_IFLNK
        int len;
+       struct stat st;
 #endif
 #define SEC_PER_YEAR   (60 * 60 * 24 * 365)
 
@@ -278,7 +279,8 @@ PRIVATE void LYListFmtParse ARGS5(
                        END(HTML_A);
                        *buf = '\0';
 #ifdef S_IFLNK
-                       if (c != 'A' && S_ISLNK(data->file_info.st_mode) &&
+                       if (lstat(file, &st)<0) st=data->file_info;
+                       if (c != 'A' && S_ISLNK(st.st_mode) &&
                            (len = readlink(file, tmp, sizeof(tmp) - 1)) >= 0) {
                                PUTS(" -> ");
                                tmp[len] = '\0';
@@ -1788,7 +1790,7 @@ PRIVATE int print_local_dir ARGS5(
                /* FIXME */
            }
            LYTrimPathSep (tmpfilename);
-           if (lstat(tmpfilename, &(data->file_info)) < 0)
+           if (stat(tmpfilename, &(data->file_info)) < 0)
                data->file_info.st_mode = 0;
 
            strcpy(data->file_name, dirbuf->d_name);
_______________________________________________
Lynx-dev mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/lynx-dev

Reply via email to