Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
hdhomerun: fix the oops cause by last update (dynamic ip), fixes #3717
  • Loading branch information
perexg committed Apr 15, 2016
1 parent 2f71335 commit 0e5fc7c
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/input/mpegts/tvhdhomerun/tvhdhomerun.c
Expand Up @@ -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 *
Expand Down Expand Up @@ -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",
Expand All @@ -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,
Expand Down

0 comments on commit 0e5fc7c

Please sign in to comment.