[vlc-devel] [PATCH] Fixes ##21595: fixed creation of cache directory if it does not exist

Aakash Singh 17aakashsingh1999 at gmail.com
Sat Mar 9 15:01:38 CET 2019


https://trac.videolan.org/vlc/ticket/21595 provides the description of the
issue.
The cache folder is created if it doesn't already exist. If it exists then
vlc_mkdir() simply returns -1.
---
 modules/lua/libs/configuration.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/modules/lua/libs/configuration.c
b/modules/lua/libs/configuration.c
index 27de94c30d..1c55d6c7d8 100644
--- a/modules/lua/libs/configuration.c
+++ b/modules/lua/libs/configuration.c
@@ -32,6 +32,7 @@
 #endif

 #include <vlc_common.h>
+#include <vlc_fs.h>

 #include "../vlc.h"
 #include "../libs.h"
@@ -136,6 +137,8 @@ static int vlclua_configdir( lua_State *L )
 static int vlclua_cachedir( lua_State *L )
 {
     char *dir = config_GetUserDir( VLC_CACHE_DIR );
+    /* create a cache folder if it doesn't already exist */
+    vlc_mkdir( dir, 0700 );
     lua_pushstring( L, dir );
     free( dir );
     return 1;
-- 
2.19.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20190309/fb55c3e3/attachment.html>


More information about the vlc-devel mailing list