From 0e5fc7c396d280f90b2dd23a62f71ca103de153b Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 15 Apr 2016 11:20:12 +0200 Subject: [PATCH] hdhomerun: fix the oops cause by last update (dynamic ip), fixes #3717 --- src/input/mpegts/tvhdhomerun/tvhdhomerun.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) 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, -- 2.47.3