]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Fix mistake in bundling code that means settings not loaded from install path.
authorAdam Sutton <dev@adamsutton.me.uk>
Tue, 21 Aug 2012 18:36:16 +0000 (19:36 +0100)
committerAdam Sutton <dev@adamsutton.me.uk>
Tue, 21 Aug 2012 18:44:30 +0000 (19:44 +0100)
src/filebundle.c

index 2bde56293af381016c39c8fe7cc9aed49427f6e2..e75b5b8245405e754a5c4ae76d2619774d74ea6c 100644 (file)
@@ -293,13 +293,13 @@ int fb_scandir ( const char *path, fb_dirent ***list )
 {
   int i, ret = -1;
   struct dirent **de;
-  struct filebundle_stat st;
-  if (fb_stat(path, &st)) return -1;
-  if (!st.is_dir) return -1;
+  fb_dir *dir;
+
+  if (!(dir = fb_opendir(path))) return -1;
 
   /* Direct */
-  if (st.type == FB_DIRECT) {
-    if ((ret = scandir(path, &de, NULL, NULL)) != -1) {
+  if (dir->type == FB_DIRECT) {
+    if ((ret = scandir(dir->d.root, &de, NULL, NULL)) != -1) {
       if (ret == 0) return 0;
       *list = malloc(sizeof(fb_dirent*)*ret);
       for (i = 0; i < ret; i++) {
@@ -313,22 +313,22 @@ int fb_scandir ( const char *path, fb_dirent ***list )
 
   /* Bundle */
   } else {
-    fb_dir *dir;
-    if ((dir = fb_opendir(path))) {
-      const filebundle_entry_t *fb;
-      ret = dir->b.root->d.count;
-      fb  = dir->b.root->d.child;
-      *list = malloc(ret * sizeof(fb_dirent));
-      i = 0;
-      while (fb) {
-        (*list)[i] = calloc(1, sizeof(fb_dirent));
-        strcpy((*list)[i]->name, fb->name);
-        fb = fb->next;
-        i++;
-      }
-      fb_closedir(dir);
+    const filebundle_entry_t *fb;
+    ret = dir->b.root->d.count;
+    fb  = dir->b.root->d.child;
+    *list = malloc(ret * sizeof(fb_dirent));
+    i = 0;
+    while (fb) {
+      (*list)[i] = calloc(1, sizeof(fb_dirent));
+      strcpy((*list)[i]->name, fb->name);
+      fb = fb->next;
+      i++;
     }
   }
+
+  /* Close */
+  fb_closedir(dir);
+
   return ret;
 }