Permalink
Browse files

Resync with libhdhomerun 080111.

Thanks to fabulously bad timing on my part, the lib was updated within hours of my grabbing a copy to resync.

Fixes an issue where devices were not detected under Mac OS X.
  • Loading branch information...
1 parent f50ceec commit c119186bb847be5c8cd751879e1a6061b45f1cec Robert McNamara committed Aug 2, 2011
Showing with 6 additions and 9 deletions.
  1. +6 −9 mythtv/libs/libmythhdhomerun/hdhomerun_sock_posix.c
@@ -65,9 +65,7 @@ int hdhomerun_local_ip_info(struct hdhomerun_local_ip_info_t ip_info_list[], int
}
struct ifconf ifc;
- struct ifreq ifreq_dummy;
- size_t ifreq_size = _SIZEOF_ADDR_IFREQ(ifreq_dummy);
- size_t ifreq_buffer_size = ifreq_size * 16;
+ size_t ifreq_buffer_size = 1024;
while (1) {
ifc.ifc_len = ifreq_buffer_size;
@@ -85,13 +83,12 @@ int hdhomerun_local_ip_info(struct hdhomerun_local_ip_info_t ip_info_list[], int
return -1;
}
- if (ifc.ifc_len >= ifreq_buffer_size) {
- free(ifc.ifc_buf);
- ifreq_buffer_size += ifreq_size * 16;
- continue;
+ if (ifc.ifc_len < ifreq_buffer_size) {
+ break;
}
- break;
+ free(ifc.ifc_buf);
+ ifreq_buffer_size += 1024;
}
char *ptr = ifc.ifc_buf;
@@ -100,7 +97,7 @@ int hdhomerun_local_ip_info(struct hdhomerun_local_ip_info_t ip_info_list[], int
int count = 0;
while (ptr <= end) {
struct ifreq *ifr = (struct ifreq *)ptr;
- ptr += ifreq_size;
+ ptr += _SIZEOF_ADDR_IFREQ(*ifr);
if (ioctl(sock, SIOCGIFADDR, ifr) != 0) {
continue;

0 comments on commit c119186

Please sign in to comment.