summaryrefslogtreecommitdiffstats
path: root/libmenu
diff options
context:
space:
mode:
Diffstat (limited to 'libmenu')
-rw-r--r--libmenu/menu_filesel.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libmenu/menu_filesel.c b/libmenu/menu_filesel.c
index 3f91080f46..e81b49ef7f 100644
--- a/libmenu/menu_filesel.c
+++ b/libmenu/menu_filesel.c
@@ -413,7 +413,8 @@ static int open_fs(menu_t* menu, char* args) {
if (path_fp >= 0) {
if (!fstat (path_fp, &st) && (st.st_size > 0)) {
path = malloc(st.st_size+1);
- if ((read(path_fp, path, st.st_size) == st.st_size) && path[0] != '\0'){
+ if ((read(path_fp, path, st.st_size) == st.st_size) && path[0] == '/'
+ && !stat(path, &st) && S_ISDIR(st.st_mode)){
freepath = path;
path[st.st_size] = '\0';
}