diff options
author | ben <ben@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-05-29 18:49:38 +0000 |
---|---|---|
committer | ben <ben@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-05-29 18:49:38 +0000 |
commit | c31274e8b43fcffc3cf43319aa17501b71729176 (patch) | |
tree | 4ed551fb1277c21f3355bfe950c6b8b78de012cf /libmenu/menu_filesel.c | |
parent | f5b407c210c1aaf4682acc71e1e14574179764c3 (diff) | |
download | mpv-c31274e8b43fcffc3cf43319aa17501b71729176.tar.bz2 mpv-c31274e8b43fcffc3cf43319aa17501b71729176.tar.xz |
new -menu-chroot option that prevent OSD file selection menu to go to an unwanted location (yeah, chroot ;-))
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23409 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmenu/menu_filesel.c')
-rw-r--r-- | libmenu/menu_filesel.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libmenu/menu_filesel.c b/libmenu/menu_filesel.c index aed24071b9..d6e8715ff0 100644 --- a/libmenu/menu_filesel.c +++ b/libmenu/menu_filesel.c @@ -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 @@ static int open_dir(menu_t* menu,char* args) { 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) |