]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Revert "DVR inotify: fix fundamental error when inotify filename is re-registered" v4.0.8
authorJaroslav Kysela <perex@perex.cz>
Wed, 16 Dec 2015 17:33:33 +0000 (18:33 +0100)
committerJaroslav Kysela <perex@perex.cz>
Wed, 16 Dec 2015 17:33:33 +0000 (18:33 +0100)
This reverts commit f55871b5f6315f71364456d59160c5b136f1cb55.

src/dvr/dvr.h
src/dvr/dvr_inotify.c

index b00e443d721ffe9f741c2778461c1408a221194b..aff07dde8f2c9e35fce6701faeaf97b828002969 100644 (file)
@@ -645,7 +645,6 @@ void dvr_inotify_init ( void );
 void dvr_inotify_done ( void );
 void dvr_inotify_add  ( dvr_entry_t *de );
 void dvr_inotify_del  ( dvr_entry_t *de );
-int  dvr_inotify_count( void );
 
 /**
  * Cutpoints support
index cab9d35f93ff903718b47da08537d4c386ed2f4e..2c29b8d44b99dc12b2eecf15148b45b574fae698 100644 (file)
@@ -56,7 +56,6 @@ static int _str_cmp ( void *a, void *b )
   return strcmp(((dvr_inotify_entry_t*)a)->path, ((dvr_inotify_entry_t*)b)->path);
 }
 
-
 /**
  * Initialise threads
  */
@@ -107,16 +106,13 @@ void dvr_inotify_add ( dvr_entry_t *de )
   dvr_inotify_entry_skel->path = dirname(path);
   
   e = RB_INSERT_SORTED(&_inot_tree, dvr_inotify_entry_skel, link, _str_cmp);
-  if (e) {
-    free(path);
-    return;
+  if (!e) {
+    e       = dvr_inotify_entry_skel;
+    SKEL_USED(dvr_inotify_entry_skel);
+    e->path = strdup(e->path);
+    e->fd   = inotify_add_watch(_inot_fd, e->path, EVENT_MASK);
   }
 
-  e       = dvr_inotify_entry_skel;
-  SKEL_USED(dvr_inotify_entry_skel);
-  e->path = strdup(e->path);
-  e->fd   = inotify_add_watch(_inot_fd, e->path, EVENT_MASK);
-
   LIST_INSERT_HEAD(&e->entries, de, de_inotify_link);
 
   if (e->fd < 0) {
@@ -154,21 +150,6 @@ void dvr_inotify_del ( dvr_entry_t *de )
   }
 }
 
-/*
- * return count of registered entries (for debugging)
- */
-int dvr_inotify_count ( void )
-{
-  dvr_entry_t *det = NULL;
-  dvr_inotify_entry_t *e;
-  int count = 0;
-  lock_assert(&global_lock);
-  RB_FOREACH(e, &_inot_tree, link)
-    LIST_FOREACH(det, &e->entries, de_inotify_link)
-      count++;
-  return count;
-}
-
 /*
  * Find inotify entry
  */