Merge pull request #2151 from zbstao/devel

Fixed possible infinite loop (regression on #2146)
This commit is contained in:
matt335672 2022-02-16 10:44:25 +00:00 committed by GitHub
commit df23c01c37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 11 deletions

View File

@ -2973,7 +2973,7 @@ g_waitchild(void)
/*****************************************************************************/
/* does not work in win32
returns pid of process that exits or zero if signal occurred */
returns pid of process that exits or <= 0 if no process was found */
int
g_waitpid(int pid)
{
@ -2989,14 +2989,6 @@ g_waitpid(int pid)
else
{
rv = waitpid(pid, 0, 0);
if (rv == -1)
{
if (errno == EINTR) /* signal occurred */
{
rv = 0;
}
}
}
return rv;

View File

@ -131,7 +131,7 @@ sig_sesman_session_end(int sig)
session_kill(pid);
}
}
while (pid >= 0);
while (pid > 0);
}
/******************************************************************************/

View File

@ -163,7 +163,7 @@ xrdp_shutdown(int sig)
static void
xrdp_child(int sig)
{
while (g_waitchild() >= 0)
while (g_waitchild() > 0)
{
}
}