diff options
author | ulion <ulion@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-12-10 14:12:40 +0000 |
---|---|---|
committer | ulion <ulion@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-12-10 14:12:40 +0000 |
commit | 03607113cb5aabc014887b4e734fc1568867901a (patch) | |
tree | 25bdf4b5145362aa7f5e9bc18d83042f2ea3e65e /libmenu | |
parent | f059a5570ee89337a7ec7fbeb747211553da94b1 (diff) | |
download | mpv-03607113cb5aabc014887b4e734fc1568867901a.tar.bz2 mpv-03607113cb5aabc014887b4e734fc1568867901a.tar.xz |
Fix mylstat() call to parent dir where the subdir has no exec permission.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25339 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmenu')
-rw-r--r-- | libmenu/menu_filesel.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/libmenu/menu_filesel.c b/libmenu/menu_filesel.c index 1480c5de0d..04e19c9019 100644 --- a/libmenu/menu_filesel.c +++ b/libmenu/menu_filesel.c @@ -117,6 +117,26 @@ typedef int (*kill_warn)(const void*, const void*); static int mylstat(char *dir, char *file,struct stat* st) { int l = strlen(dir) + strlen(file); char s[l+2]; + if (!strcmp("..", file)) { + char *slash; + l -= 3; + strcpy(s, dir); +#if defined(__MINGW32__) || defined(__CYGWIN__) + if (s[l] == '/' || s[l] == '\\') +#else + if (s[l] == '/') +#endif + s[l] = '\0'; + slash = strrchr(s, '/'); +#if defined(__MINGW32__) || defined(__CYGWIN__) + if (!slash) + slash = strrchr(s,'\\'); +#endif + if (!slash) + return stat(dir,st); + slash[1] = '\0'; + return stat(s,st); + } sprintf(s,"%s/%s",dir,file); return stat(s,st); } @@ -229,7 +249,8 @@ static int menu_open_dir(menu_t* menu,char* args) { && !strncmp (mpriv->dir, menu_chroot, len)) continue; } - mylstat(args,dp->d_name,&st); + if (mylstat(args,dp->d_name,&st)) + continue; if (file_filter && extensions && !S_ISDIR(st.st_mode)) { if((ext = strrchr(dp->d_name,'.')) == NULL) continue; |