sesman: address the issue of socket file leftovers
There are two points. Make sure cleanup files happen after chansrv and Xserver exit. If these child processes lock socket files, the deletion might fail. Usually, cleanup of xorgxrdp related socket files is handled by xorgxrdp. Just in case it failed, perform cleanup also in sesman. Fixes #1740. Thanks to @matt335672. Sponsored by: Cybertrust Japan Sponsored by: HAW International
This commit is contained in:
parent
e6c1df64d3
commit
5114d1ee64
@ -820,6 +820,11 @@ session_start_fork(tbus data, tui8 type, struct SCP_CONNECTION *c,
|
||||
auth_end(data);
|
||||
g_sigterm(display_pid);
|
||||
g_sigterm(chansrv_pid);
|
||||
|
||||
/* make sure socket cleanup happen after child process exit */
|
||||
g_waitpid(display_pid);
|
||||
g_waitpid(chansrv_pid);
|
||||
|
||||
cleanup_sockets(display);
|
||||
g_deinit();
|
||||
g_exit(0);
|
||||
@ -1199,6 +1204,33 @@ cleanup_sockets(int display)
|
||||
}
|
||||
}
|
||||
|
||||
/* the following files should be deleted by xorgxrdp
|
||||
* but just in case the deletion failed */
|
||||
|
||||
g_snprintf(file, 255, XRDP_X11RDP_STR, display);
|
||||
if (g_file_exist(file))
|
||||
{
|
||||
LOG(LOG_LEVEL_DEBUG, "cleanup_sockets: deleting %s", file);
|
||||
if (g_file_delete(file) == 0)
|
||||
{
|
||||
LOG(LOG_LEVEL_DEBUG,
|
||||
"cleanup_sockets: failed to delete %s", file);
|
||||
error++;
|
||||
}
|
||||
}
|
||||
|
||||
g_snprintf(file, 255, XRDP_DISCONNECT_STR, display);
|
||||
if (g_file_exist(file))
|
||||
{
|
||||
LOG(LOG_LEVEL_DEBUG, "cleanup_sockets: deleting %s", file);
|
||||
if (g_file_delete(file) == 0)
|
||||
{
|
||||
LOG(LOG_LEVEL_DEBUG,
|
||||
"cleanup_sockets: failed to delete %s", file);
|
||||
error++;
|
||||
}
|
||||
}
|
||||
|
||||
return error;
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user