about summary refs log tree commit diff stats
path: root/WWW/Library/Implementation/HTFile.c
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2004-10-11 00:44:26 -0400
committerThomas E. Dickey <dickey@invisible-island.net>2004-10-11 00:44:26 -0400
commitff34560f27f6cc7ba97cfc11e10973ac34735c4c (patch)
tree937595d7e6eac4873a7a0749e5c126d43d7c1c54 /WWW/Library/Implementation/HTFile.c
parentceb4156db8546c98875607dd91a799101b02c22f (diff)
downloadlynx-snapshots-ff34560f27f6cc7ba97cfc11e10973ac34735c4c.tar.gz
snapshot of project "lynx", label v2-8-6dev_6
Diffstat (limited to 'WWW/Library/Implementation/HTFile.c')
-rw-r--r--WWW/Library/Implementation/HTFile.c30
1 files changed, 25 insertions, 5 deletions
diff --git a/WWW/Library/Implementation/HTFile.c b/WWW/Library/Implementation/HTFile.c
index e5f6d77d..bf10952f 100644
--- a/WWW/Library/Implementation/HTFile.c
+++ b/WWW/Library/Implementation/HTFile.c
@@ -1696,6 +1696,11 @@ static int print_local_dir(DIR *dp, char *localname,
     BOOL need_parent_link = FALSE;
     int status;
     int i;
+    struct stat *actual_info;
+
+#ifdef S_IFLNK
+    struct stat link_info;
+#endif
 
     CTRACE((tfp, "print_local_dir() started\n"));
 
@@ -1796,22 +1801,37 @@ static int print_local_dir(DIR *dp, char *localname,
 	    StrAllocCat(tmpfilename, dirbuf->d_name);
 	    data = (DIRED *) malloc(sizeof(DIRED) + strlen(dirbuf->d_name) + 4);
 	    if (data == NULL) {
-		/* FIXME */
+		status = HT_PARTIAL_CONTENT;
+		break;
 	    }
 	    LYTrimPathSep(tmpfilename);
-	    if (lstat(tmpfilename, &(data->file_info)) < 0)
-		data->file_info.st_mode = 0;
+
+	    actual_info = &(data->file_info);
+#ifdef S_IFLNK
+	    if (lstat(tmpfilename, actual_info) < 0) {
+		actual_info->st_mode = 0;
+	    } else {
+		if (S_ISLNK(actual_info->st_mode)) {
+		    actual_info = &link_info;
+		    if (stat(tmpfilename, actual_info) < 0)
+			actual_info->st_mode = 0;
+		}
+	    }
+#else
+	    if (stat(tmpfilename, actual_info) < 0)
+		actual_info->st_mode = 0;
+#endif
 
 	    strcpy(data->file_name, dirbuf->d_name);
 #ifndef DIRED_SUPPORT
-	    if (S_ISDIR(data->file_info.st_mode)) {
+	    if (S_ISDIR(actual_info->st_mode)) {
 		data->sort_tags = 'D';
 	    } else {
 		data->sort_tags = 'F';
 		/* D & F to have first directories, then files */
 	    }
 #else
-	    if (S_ISDIR(data->file_info.st_mode)) {
+	    if (S_ISDIR(actual_info->st_mode)) {
 		if (dir_list_style == MIXED_STYLE) {
 		    data->sort_tags = ' ';
 		    LYAddPathSep0(data->file_name);