Ticket #9421: 0001-Fix-race-condition-on-m_pMap-read-on-close.patch

File 0001-Fix-race-condition-on-m_pMap-read-on-close.patch, 891 bytes (added by beirdo, 9 years ago)
  • mythtv/libs/libmythdb/system-unix.cpp

    From 29dab31b110059ccc34e739ccdce66603a2c92b9 Mon Sep 17 00:00:00 2001
    From: Gavin Hurlbut <ghurlbut@mythtv.org>
    Date: Wed, 5 Jan 2011 19:19:03 -0800
    Subject: [PATCH] Fix race condition on m_pMap read on close
    
    We really should check that it DID find an fd in the map.
    ---
     mythtv/libs/libmythdb/system-unix.cpp |    3 ++-
     1 files changed, 2 insertions(+), 1 deletions(-)
    
    diff --git a/mythtv/libs/libmythdb/system-unix.cpp b/mythtv/libs/libmythdb/system-unix.cpp
    index 960ed3c..0f29c6e 100644
    a b void MythSystemIOHandler::remove(int fd) 
    203203    {
    204204        PMap_t::iterator i;
    205205        i = m_pMap.find(fd);
    206         HandleRead(i.key(), i.value());
     206        if ( i != m_pMap.end() )
     207            HandleRead(i.key(), i.value());
    207208    }
    208209    m_pMap.remove(fd);
    209210    BuildFDs();