Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
dvr_inotify: coverity fixes
  • Loading branch information
perexg committed Oct 3, 2014
1 parent 1069ff4 commit f7336d2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/dvr/dvr_inotify.c
Expand Up @@ -64,7 +64,7 @@ pthread_t dvr_inotify_tid;
void dvr_inotify_init ( void )
{
_inot_fd = inotify_init();
if (_inot_fd == -1) {
if (_inot_fd < 0) {
tvhlog(LOG_ERR, "dvr", "failed to initialise inotify (err=%s)",
strerror(errno));
return;
Expand Down Expand Up @@ -95,7 +95,7 @@ void dvr_inotify_add ( dvr_entry_t *de )
char *path;
struct stat st;

if (_inot_fd == -1)
if (_inot_fd < 0)
return;

if (!de->de_filename || stat(de->de_filename, &st))
Expand Down Expand Up @@ -267,7 +267,7 @@ void* _dvr_inotify_thread ( void *p )
int fromfd;
int cookie;

while (1) {
while (_inot_fd >= 0) {

/* Read events */
fromfd = 0;
Expand All @@ -283,6 +283,8 @@ void* _dvr_inotify_thread ( void *p )
while ( i < len ) {
struct inotify_event *ev = (struct inotify_event*)&buf[i];
i += EVENT_SIZE + ev->len;
if (i > len)
break;

/* Moved */
if (ev->mask & IN_MOVED_FROM) {
Expand Down

0 comments on commit f7336d2

Please sign in to comment.