From f32a3ce5d5ed9f421d764a25794bcdbce4a0cb20 Mon Sep 17 00:00:00 2001 From: deuce <> Date: Fri, 5 Aug 2005 02:21:36 +0000 Subject: [PATCH] Fix SEGFAULT on upload from empty directory two ways: 1) Properly initialize variables. 2) Just because a directory is empty doesn't mean it doesn't exist. --- src/uifc/filepick.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/uifc/filepick.c b/src/uifc/filepick.c index 419d15a2df..f50b55e14f 100644 --- a/src/uifc/filepick.c +++ b/src/uifc/filepick.c @@ -298,8 +298,8 @@ int filepick(uifcapi_t *api, char *title, struct file_pick *fp, char *dir, char int filecur=0; int filebar=0; int listwidth; - char **dir_list; - char **file_list; + char **dir_list=NULL; + char **file_list=NULL; int currfield=DIR_LIST; int lastfield=DIR_LIST; int i; @@ -386,7 +386,7 @@ int filepick(uifcapi_t *api, char *title, struct file_pick *fp, char *dir, char #else //#error Need to do something about root paths (in get_file_opt_list() too!) #endif - if(glob(dglob, GLOB_MARK, NULL, &dgl)!=0) { + if(glob(dglob, GLOB_MARK, NULL, &dgl)!=0 && !isdir(cpath)) { if(lastpath==NULL) { fp->files=0; retval=-1; -- GitLab