changeset 25299:0335de28ee01

Use recorded last path only when stat it ok.
author ulion
date Sun, 09 Dec 2007 07:50:37 +0000
parents 23894348d1e5
children b1638a8b9dc6
files libmenu/menu_filesel.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmenu/menu_filesel.c	Sun Dec 09 06:58:57 2007 +0000
+++ b/libmenu/menu_filesel.c	Sun Dec 09 07:50:37 2007 +0000
@@ -413,7 +413,8 @@
       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';
           }