Merge pull request #1756 from metalefty/delete-socket-files
sesman: address the issue of socket file leftovers
This commit is contained in:
commit
61fd63f028
@ -820,6 +820,11 @@ session_start_fork(tbus data, tui8 type, struct SCP_CONNECTION *c,
|
|||||||
auth_end(data);
|
auth_end(data);
|
||||||
g_sigterm(display_pid);
|
g_sigterm(display_pid);
|
||||||
g_sigterm(chansrv_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);
|
cleanup_sockets(display);
|
||||||
g_deinit();
|
g_deinit();
|
||||||
g_exit(0);
|
g_exit(0);
|
||||||
@ -1157,8 +1162,9 @@ cleanup_sockets(int display)
|
|||||||
LOG(LOG_LEVEL_DEBUG, "cleanup_sockets: deleting %s", file);
|
LOG(LOG_LEVEL_DEBUG, "cleanup_sockets: deleting %s", file);
|
||||||
if (g_file_delete(file) == 0)
|
if (g_file_delete(file) == 0)
|
||||||
{
|
{
|
||||||
LOG(LOG_LEVEL_DEBUG,
|
LOG(LOG_LEVEL_WARNING,
|
||||||
"cleanup_sockets: failed to delete %s", file);
|
"cleanup_sockets: failed to delete %s (%s)",
|
||||||
|
file, g_get_strerror());
|
||||||
error++;
|
error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1169,8 +1175,9 @@ cleanup_sockets(int display)
|
|||||||
LOG(LOG_LEVEL_DEBUG, "cleanup_sockets: deleting %s", file);
|
LOG(LOG_LEVEL_DEBUG, "cleanup_sockets: deleting %s", file);
|
||||||
if (g_file_delete(file) == 0)
|
if (g_file_delete(file) == 0)
|
||||||
{
|
{
|
||||||
LOG(LOG_LEVEL_DEBUG,
|
LOG(LOG_LEVEL_WARNING,
|
||||||
"cleanup_sockets: failed to delete %s", file);
|
"cleanup_sockets: failed to delete %s (%s)",
|
||||||
|
file, g_get_strerror());
|
||||||
error++;
|
error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1181,8 +1188,9 @@ cleanup_sockets(int display)
|
|||||||
LOG(LOG_LEVEL_DEBUG, "cleanup_sockets: deleting %s", file);
|
LOG(LOG_LEVEL_DEBUG, "cleanup_sockets: deleting %s", file);
|
||||||
if (g_file_delete(file) == 0)
|
if (g_file_delete(file) == 0)
|
||||||
{
|
{
|
||||||
LOG(LOG_LEVEL_DEBUG,
|
LOG(LOG_LEVEL_WARNING,
|
||||||
"cleanup_sockets: failed to delete %s", file);
|
"cleanup_sockets: failed to delete %s (%s)",
|
||||||
|
file, g_get_strerror());
|
||||||
error++;
|
error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1193,8 +1201,38 @@ cleanup_sockets(int display)
|
|||||||
LOG(LOG_LEVEL_DEBUG, "cleanup_sockets: deleting %s", file);
|
LOG(LOG_LEVEL_DEBUG, "cleanup_sockets: deleting %s", file);
|
||||||
if (g_file_delete(file) == 0)
|
if (g_file_delete(file) == 0)
|
||||||
{
|
{
|
||||||
LOG(LOG_LEVEL_DEBUG,
|
LOG(LOG_LEVEL_WARNING,
|
||||||
"cleanup_sockets: failed to delete %s", file);
|
"cleanup_sockets: failed to delete %s (%s)",
|
||||||
|
file, g_get_strerror());
|
||||||
|
error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 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_WARNING,
|
||||||
|
"cleanup_sockets: failed to delete %s (%s)",
|
||||||
|
file, g_get_strerror());
|
||||||
|
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_WARNING,
|
||||||
|
"cleanup_sockets: failed to delete %s (%s)",
|
||||||
|
file, g_get_strerror());
|
||||||
error++;
|
error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user