From: Jaroslav Kysela Date: Fri, 15 Apr 2016 09:20:12 +0000 (+0200) Subject: hdhomerun: fix the oops cause by last update (dynamic ip), fixes #3717 X-Git-Tag: v4.2.1~649 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0e5fc7c396d280f90b2dd23a62f71ca103de153b;p=thirdparty%2Ftvheadend.git hdhomerun: fix the oops cause by last update (dynamic ip), fixes #3717 --- diff --git a/src/input/mpegts/tvhdhomerun/tvhdhomerun.c b/src/input/mpegts/tvhdhomerun/tvhdhomerun.c index 81534bcc2..eb9fd43ec 100644 --- a/src/input/mpegts/tvhdhomerun/tvhdhomerun.c +++ b/src/input/mpegts/tvhdhomerun/tvhdhomerun.c @@ -84,13 +84,12 @@ static tvh_cond_t tvhdhomerun_discovery_cond; static const char * tvhdhomerun_device_class_get_title( idnode_t *in, const char *lang ) { - static char buf[256]; tvhdhomerun_device_t *hd = (tvhdhomerun_device_t *)in; char ip[64]; tcp_get_str_from_ip((struct sockaddr *)&hd->hd_info.ip_address, ip, sizeof(ip)); - snprintf(buf, sizeof(buf), + snprintf(prop_sbuf, PROP_SBUF_LEN, "%s - %s", hd->hd_info.friendlyname, ip); - return buf; + return prop_sbuf; } static htsmsg_t * @@ -151,6 +150,14 @@ tvhdhomerun_device_class_override_notify( void * obj, const char *lang ) } } +static const void * +tvhdhomerun_device_class_get_ip_address ( void *obj ) +{ + tvhdhomerun_device_t *hd = obj; + tcp_get_str_from_ip((struct sockaddr *)&hd->hd_info.ip_address, prop_sbuf, PROP_SBUF_LEN); + return &prop_sbuf; +} + const idclass_t tvhdhomerun_device_class = { .ic_class = "tvhdhomerun_client", @@ -171,7 +178,7 @@ const idclass_t tvhdhomerun_device_class = .id = "ip_address", .name = N_("IP address"), .opts = PO_RDONLY | PO_NOSAVE, - .off = offsetof(tvhdhomerun_device_t, hd_info.ip_address), + .get = tvhdhomerun_device_class_get_ip_address, }, { .type = PT_STR,