fix in6_addr problems
[record-dvb] / sap.c
diff --git a/sap.c b/sap.c
index 6a8ef799e6a0831a6de2f5fa6be677045cfe9ca5..da1d95948d3285e94fc533cdf03b5933eb363140 100644 (file)
--- a/sap.c
+++ b/sap.c
@@ -204,7 +204,7 @@ char *get_url_from_sap(char *service)
                                 if (sap_addrtype) {
                                         struct in6_addr in6addr;
 
-                                        memcpy(in6addr.in6_u.u6_addr8, sender_address, 16);
+                                        memcpy(in6addr.s6_addr, sender_address, 16);
                                         if (!(sdpinfo->host = (char*)inet_ntop(AF_INET6, &in6addr, hostbuf, INET6_ADDRSTRLEN))) {
                                                 perror("inet_ntop");
                                                 continue;
@@ -242,7 +242,8 @@ char *get_url_from_sap(char *service)
                        }
                }
 
-       } while(curr.tv_sec < start.tv_sec+SAP_TIMEOUT);
+       } while(curr.tv_sec < start.tv_sec+SAP_TIMEOUT ||
+               ((curr.tv_sec == start.tv_sec+SAP_TIMEOUT) && (curr.tv_usec < start.tv_usec)));
 
        if (!(inet_aton(SAP_ADDR, &sapinaddr))) {
                perror("inet_aton");
Impressum, Datenschutz