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
master
matt335672 7 years ago committed by metalefty
parent 4d14f344fd
commit 4023aa7f1c

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

Loading…
Cancel
Save