Skip to content

Commit

Permalink
Properly handle fd number 0 in signal manager
Browse files Browse the repository at this point in the history
Visual analysis (IEAEYEBALL) detected that the
check for the file descriptor value should be
"fd >= 0" and not just "fd > 0".  While a fd of
zero is commonly stdin, do the right check just
in case.

The CLOSE macro properly performs the check
for greater than or equal to zero.  This
patch just does the same thing.

Fixes #11630.

Signed-off-by: Paul Harrison <pharrison@mythtv.org>
  • Loading branch information
garybuhrmaster authored and Paul Harrison committed Jul 1, 2013
1 parent eac883a commit c416822
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mythtv/libs/libmythbase/mythsystemunix.cpp
Expand Up @@ -536,15 +536,15 @@ void MythSystemLegacySignalManager::run(void)
ms->m_parent->HandlePostRun();
}

if (ms->m_stdpipe[0] > 0)
if (ms->m_stdpipe[0] >= 0)
writeThread->remove(ms->m_stdpipe[0]);
CLOSE(ms->m_stdpipe[0]);

if (ms->m_stdpipe[1] > 0)
if (ms->m_stdpipe[1] >= 0)
readThread->remove(ms->m_stdpipe[1]);
CLOSE(ms->m_stdpipe[1]);

if (ms->m_stdpipe[2] > 0)
if (ms->m_stdpipe[2] >= 0)
readThread->remove(ms->m_stdpipe[2]);
CLOSE(ms->m_stdpipe[2]);

Expand Down

0 comments on commit c416822

Please sign in to comment.