Merge pull request #1299 from matt335672/clear-drives-on-disconnect

Reconnecting to session causes duplicate drive entries in fuse fs
This commit is contained in:
metalefty 2019-03-08 11:12:43 +09:00 committed by GitHub
commit dea3408a8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -492,7 +492,6 @@ xfuse_init(void)
int int
xfuse_deinit(void) xfuse_deinit(void)
{ {
xfuse_deinit_xrdp_fs();
fifo_deinit(&g_fifo_opendir); fifo_deinit(&g_fifo_opendir);
if (g_ch != 0) if (g_ch != 0)
@ -520,6 +519,8 @@ xfuse_deinit(void)
g_req_list = 0; g_req_list = 0;
} }
xfuse_deinit_xrdp_fs();
g_xfuse_inited = 0; g_xfuse_inited = 0;
return 0; return 0;
} }
@ -969,6 +970,28 @@ static int xfuse_init_xrdp_fs(void)
static int xfuse_deinit_xrdp_fs(void) static int xfuse_deinit_xrdp_fs(void)
{ {
fuse_ino_t i;
struct xrdp_inode *xinode;
if (g_xrdp_fs.inode_table != NULL)
{
for (i = FIRST_INODE; i < g_xrdp_fs.num_entries; ++i)
{
if ((xinode = g_xrdp_fs.inode_table[i]) != NULL)
{
g_xrdp_fs.inode_table[i] = NULL;
log_debug("Freeing %s",xinode->name);
free(xinode);
}
}
free(g_xrdp_fs.inode_table);
g_xrdp_fs.inode_table = NULL;
}
g_xrdp_fs.max_entries = 0;
g_xrdp_fs.num_entries = 0;
g_xrdp_fs.next_node = 1;
return 0; return 0;
} }