From: Kin-Wai Koo Date: Tue, 22 Jan 2019 06:40:40 +0000 (+0800) Subject: Log an error message if the configured IP address is invalid X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b253613ef6feab9da3fe46bb726f0c2dbec3e8b5;p=thirdparty%2Ftvheadend.git Log an error message if the configured IP address is invalid --- diff --git a/src/input/mpegts/tvhdhomerun/tvhdhomerun.c b/src/input/mpegts/tvhdhomerun/tvhdhomerun.c index 4f17d0ef8..58dec51ab 100644 --- a/src/input/mpegts/tvhdhomerun/tvhdhomerun.c +++ b/src/input/mpegts/tvhdhomerun/tvhdhomerun.c @@ -393,7 +393,7 @@ tvhdhomerun_ip( void ) if (inet_pton(AF_INET, config.hdhomerun_ip, &ip)) ip = ntohl(ip); else - tvhwarn(LS_TVHDHOMERUN, "Could not parse IP address %s", config.hdhomerun_ip); + tvherror(LS_TVHDHOMERUN, "Could not parse IP address %s", config.hdhomerun_ip); return ip; } diff --git a/src/input/mpegts/tvhdhomerun/tvhdhomerun_frontend.c b/src/input/mpegts/tvhdhomerun/tvhdhomerun_frontend.c index b1d6c7813..7d1452960 100644 --- a/src/input/mpegts/tvhdhomerun/tvhdhomerun_frontend.c +++ b/src/input/mpegts/tvhdhomerun/tvhdhomerun_frontend.c @@ -93,11 +93,12 @@ tvhdhomerun_frontend_input_thread ( void *aux ) /* local IP */ /* TODO: this is nasty */ - local_ip = hdhomerun_device_get_local_machine_addr(hfe->hf_hdhomerun_tuner); - if ((*config.local_ip != 0) && inet_pton(AF_INET, config.local_ip, &local_ip)) - { + if (*config.local_ip == 0) + local_ip = hdhomerun_device_get_local_machine_addr(hfe->hf_hdhomerun_tuner); + else if (inet_pton(AF_INET, config.local_ip, &local_ip)) local_ip = ntohl(local_ip); - } + else + tvherror(LS_TVHDHOMERUN, "failed to parse local IP (%s)", config.local_ip); /* first setup a local socket for the device to stream to */ sockfd = tvh_socket(AF_INET, SOCK_DGRAM, 0);