Mercurial > mplayer.hg
diff libmenu/menu_filesel.c @ 23391:9bf57f60bf0a
new -menu-chroot option that prevent OSD file selection menu to go to an unwanted location (yeah, chroot ;-))
author | ben |
---|---|
date | Tue, 29 May 2007 18:49:38 +0000 |
parents | ae2a2d5ca64b |
children | dcf1bfb29dc8 |
line wrap: on
line diff
--- a/libmenu/menu_filesel.c Tue May 29 16:14:52 2007 +0000 +++ b/libmenu/menu_filesel.c Tue May 29 18:49:38 2007 +0000 @@ -30,6 +30,7 @@ #define MENU_KEEP_PATH "/tmp/mp_current_path" int menu_keepdir = 0; +char *menu_chroot = NULL; struct list_entry_s { struct list_entry p; @@ -222,6 +223,12 @@ while ((dp = readdir(dirp)) != NULL) { if(dp->d_name[0] == '.' && strcmp(dp->d_name,"..") != 0) continue; + if (menu_chroot && !strcmp (dp->d_name,"..")) { + int len = strlen (menu_chroot); + if ((strlen (mpriv->dir) == len || strlen (mpriv->dir) == len + 1) + && !strncmp (mpriv->dir, menu_chroot, len)) + continue; + } mylstat(args,dp->d_name,&st); if (file_filter && extensions && !S_ISDIR(st.st_mode)) { if((ext = strrchr(dp->d_name,'.')) == NULL)