From: Damjan Marion Date: Mon, 2 Jun 2014 14:08:01 +0000 (+0200) Subject: tvheadend_webroot can be NULL X-Git-Tag: v4.1~2008^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d0343de703b7f249b2def583c8b8d3574258ef61;p=thirdparty%2Ftvheadend.git tvheadend_webroot can be NULL --- diff --git a/src/avahi.c b/src/avahi.c index d9e512b06..c1084c5ed 100644 --- a/src/avahi.c +++ b/src/avahi.c @@ -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; diff --git a/src/bonjour.c b/src/bonjour.c index 7b1ea909c..423decfa6 100644 --- a/src/bonjour.c +++ b/src/bonjour.c @@ -104,7 +104,7 @@ void bonjour_init(void) { txt_rec_t txt_rec_http[] = { - { "path", tvheadend_webroot }, + { "path", tvheadend_webroot ? tvheadend_webroot : "/" }, { .key = NULL } };