xfuse_create_share() called before xfuse_init()

* Initialise inode table in `xfuse_create_share()` if necessary
* Add guard to `xfuse_init_xrdp_fs()` to prevent double initialisation of the inode table
This commit is contained in:
matt335672 2017-07-31 11:06:49 +01:00 committed by metalefty
parent 4d14f344fd
commit 4023aa7f1c
1 changed files with 12 additions and 0 deletions

View File

@ -611,6 +611,12 @@ int xfuse_create_share(tui32 device_id, const char *dirname)
if (dirname == NULL || strlen(dirname) == 0)
return -1;
/* Do we have an inode table yet? */
if (xfuse_init_xrdp_fs())
{
return -1;
}
xinode = g_new0(struct xrdp_inode, 1);
if (xinode == NULL)
{
@ -858,6 +864,12 @@ static int xfuse_init_xrdp_fs(void)
{
struct xrdp_inode *xino;
/* Already called? */
if (g_xrdp_fs.inode_table != NULL)
{
return 0;
}
g_xrdp_fs.inode_table = g_new0(struct xrdp_inode *, 4096);
if (g_xrdp_fs.inode_table == NULL)
{