From d5fcb00271785add4424d0bd173ecfacd0c5b4a1 Mon Sep 17 00:00:00 2001 From: insofaras Date: Tue, 7 Jun 2016 18:46:53 +0100 Subject: [PATCH] linux: correctly identify symlinks to folders in file list --- linux_4ed.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/linux_4ed.cpp b/linux_4ed.cpp index c6de9978..439bbc24 100644 --- a/linux_4ed.cpp +++ b/linux_4ed.cpp @@ -471,18 +471,15 @@ Sys_Set_File_List_Sig(system_set_file_list){ cursor_start = cursor; for (; *fname; ) *cursor++ = *fname++; -#ifdef _DIRENT_HAVE_D_TYPE - if(entry->d_type != DT_UNKNOWN){ - info_ptr->folder = entry->d_type == DT_DIR; - } else -#endif - { + if(entry->d_type == DT_LNK){ struct stat st; - if(lstat(entry->d_name, &st) != -1){ + if(stat(entry->d_name, &st) != -1){ info_ptr->folder = S_ISDIR(st.st_mode); } else { info_ptr->folder = 0; } + } else { + info_ptr->folder = entry->d_type == DT_DIR; } info_ptr->filename.str = cursor_start;