Mercurial > mplayer.hg
changeset 25311:605f00b6a4ae
Fix mylstat() call to parent dir where the subdir has no exec permission.
author | ulion |
---|---|
date | Mon, 10 Dec 2007 14:12:40 +0000 |
parents | e3c5cd98d59a |
children | 643c5e2b6b56 |
files | libmenu/menu_filesel.c |
diffstat | 1 files changed, 22 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/libmenu/menu_filesel.c Mon Dec 10 13:18:27 2007 +0000 +++ b/libmenu/menu_filesel.c Mon Dec 10 14:12:40 2007 +0000 @@ -117,6 +117,26 @@ 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 @@ && !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;