]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
tvheadend_webroot can be NULL 414/head
authorDamjan Marion <damjan.marion@gmail.com>
Mon, 2 Jun 2014 14:08:01 +0000 (16:08 +0200)
committerDamjan Marion <damjan.marion@gmail.com>
Mon, 2 Jun 2014 14:08:01 +0000 (16:08 +0200)
src/avahi.c
src/bonjour.c

index d9e512b065ab2185bf989ce4969e515872a8b009..c1084c5eda2b38ad888364541f6224ef8b61eff9 100644 (file)
@@ -148,8 +148,12 @@ create_services(AvahiClient *c)
       goto fail;
     }
 
-    path = malloc(strlen(tvheadend_webroot) + 6);
-    sprintf(path, "path=%s", tvheadend_webroot);
+    if (tvheadend_webroot) {
+      path = malloc(strlen(tvheadend_webroot) + 6);
+      sprintf(path, "path=%s", tvheadend_webroot);
+    } else {
+      path = "/";
+    }
 
     /* Add the service for HTTP */
     if ((ret = avahi_entry_group_add_service(group, AVAHI_IF_UNSPEC, 
@@ -158,7 +162,8 @@ create_services(AvahiClient *c)
                                             path,
                                             NULL)) < 0) {
 
-    free(path);
+    if (tvheadend_webroot)
+      free(path);
 
       if (ret == AVAHI_ERR_COLLISION)
        goto collision;
index 7b1ea909c12425aac147744b50922dbf50ddb5a3..423decfa68b62b12b876c84206cf18b1f76d562f 100644 (file)
@@ -104,7 +104,7 @@ void
 bonjour_init(void)
 {
   txt_rec_t txt_rec_http[] = {
-    { "path", tvheadend_webroot },
+    { "path", tvheadend_webroot ? tvheadend_webroot : "/" },
     { .key = NULL }
   };