projects
/
vuplus_dvbapp
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
87ba1af
)
Avoid to use invalid file descriptor.
author
hschang
<chang@dev3>
Mon, 21 Nov 2016 07:08:04 +0000
(16:08 +0900)
committer
hschang
<chang@dev3>
Mon, 21 Nov 2016 07:11:18 +0000
(16:11 +0900)
lib/dvb/demux.cpp
patch
|
blob
|
history
lib/dvb/dvb.cpp
patch
|
blob
|
history
diff --git
a/lib/dvb/demux.cpp
b/lib/dvb/demux.cpp
index
0d03927
..
0cebc70
100644
(file)
--- a/
lib/dvb/demux.cpp
+++ b/
lib/dvb/demux.cpp
@@
-98,6
+98,7
@@
RESULT eDVBDemux::setSourceFrontend(int fenum)
{
#if HAVE_DVB_API_VERSION >= 3
int fd = openDemux();
{
#if HAVE_DVB_API_VERSION >= 3
int fd = openDemux();
+ if (fd < 0) return -1;
int n = DMX_SOURCE_FRONT0 + fenum;
int res = ::ioctl(fd, DMX_SET_SOURCE, &n);
if (res)
int n = DMX_SOURCE_FRONT0 + fenum;
int res = ::ioctl(fd, DMX_SET_SOURCE, &n);
if (res)
@@
-114,6
+115,7
@@
RESULT eDVBDemux::setSourcePVR(int pvrnum)
{
#if HAVE_DVB_API_VERSION >= 3
int fd = openDemux();
{
#if HAVE_DVB_API_VERSION >= 3
int fd = openDemux();
+ if (fd < 0) return -1;
int n = DMX_SOURCE_DVR0 + pvrnum;
int res = ::ioctl(fd, DMX_SET_SOURCE, &n);
source = -1;
int n = DMX_SOURCE_DVR0 + pvrnum;
int res = ::ioctl(fd, DMX_SET_SOURCE, &n);
source = -1;
@@
-584,6
+586,7
@@
RESULT eDVBTSRecorder::start()
{
eDebug("DMX_SET_PES_FILTER: %m");
::close(m_source_fd);
{
eDebug("DMX_SET_PES_FILTER: %m");
::close(m_source_fd);
+ m_source_fd = -1;
return -3;
}
return -3;
}
@@
-677,25
+680,33
@@
RESULT eDVBTSRecorder::stop()
#if HAVE_DVB_API_VERSION >= 5
/* workaround for record thread stop */
#if HAVE_DVB_API_VERSION >= 5
/* workaround for record thread stop */
- if (::ioctl(m_source_fd, DMX_STOP) < 0)
- perror("DMX_STOP");
- else
- state &= ~1;
+ if (m_source_fd >= 0)
+ {
+ if (::ioctl(m_source_fd, DMX_STOP) < 0)
+ perror("DMX_STOP");
+ else
+ state &= ~1;
- if (::close(m_source_fd) < 0)
- perror("close");
- else
- state &= ~2;
+ if (::close(m_source_fd) < 0)
+ perror("close");
+ else
+ state &= ~2;
+ m_source_fd = -1;
+ }
#endif
m_thread->stop();
if (state & 3)
#endif
m_thread->stop();
if (state & 3)
- ::close(m_source_fd);
+ {
+ if (m_source_fd >= 0)
+ {
+ ::close(m_source_fd);
+ m_source_fd = -1;
+ }
+ }
m_running = 0;
m_running = 0;
- m_source_fd = -1;
-
m_thread->stopSaveMetaInformation();
return 0;
}
m_thread->stopSaveMetaInformation();
return 0;
}
diff --git
a/lib/dvb/dvb.cpp
b/lib/dvb/dvb.cpp
index
72d4687
..
0c36b7c
100755
(executable)
--- a/
lib/dvb/dvb.cpp
+++ b/
lib/dvb/dvb.cpp
@@
-2071,7
+2071,10
@@
void eDVBChannel::stopSource()
m_pvr_thread = 0;
}
if (m_pvr_fd_dst >= 0)
m_pvr_thread = 0;
}
if (m_pvr_fd_dst >= 0)
+ {
::close(m_pvr_fd_dst);
::close(m_pvr_fd_dst);
+ m_pvr_fd_dst = -1;
+ }
ePtr<iTsSource> d;
m_tstools.setSource(d);
}
ePtr<iTsSource> d;
m_tstools.setSource(d);
}