changeset 2768:20156cdb5f84 libavformat

Remove perror() usage from udp.c
author lucabe
date Mon, 19 Nov 2007 08:07:33 +0000
parents 59fb7b65fcc6
children bbdec194cf36
files udp.c
diffstat 1 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/udp.c	Mon Nov 19 07:54:04 2007 +0000
+++ b/udp.c	Mon Nov 19 08:07:33 2007 +0000
@@ -48,7 +48,7 @@
 #ifdef IP_MULTICAST_TTL
     if (addr->sa_family == AF_INET) {
         if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, &mcastTTL, sizeof(mcastTTL)) < 0) {
-            perror("setsockopt(IP_MULTICAST_TTL)");
+            av_log(NULL, AV_LOG_ERROR, "setsockopt(IP_MULTICAST_TTL): %s\n", strerror(errno));
             return -1;
         }
     }
@@ -56,7 +56,7 @@
 #ifdef CONFIG_IPV6
     if (addr->sa_family == AF_INET6) {
         if (setsockopt(sockfd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &mcastTTL, sizeof(mcastTTL)) < 0) {
-            perror("setsockopt(IPV6_MULTICAST_HOPS)");
+            av_log(NULL, AV_LOG_ERROR, "setsockopt(IPV6_MULTICAST_HOPS): %s\n", strerror(errno));
             return -1;
         }
     }
@@ -72,7 +72,7 @@
         mreq.imr_multiaddr.s_addr = ((struct sockaddr_in *)addr)->sin_addr.s_addr;
         mreq.imr_interface.s_addr= INADDR_ANY;
         if (setsockopt(sockfd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (const void *)&mreq, sizeof(mreq)) < 0) {
-            perror("setsockopt(IP_ADD_MEMBERSHIP)");
+            av_log(NULL, AV_LOG_ERROR, "setsockopt(IP_ADD_MEMBERSHIP): %s\n", strerror(errno));
             return -1;
         }
     }
@@ -84,7 +84,7 @@
         memcpy(&mreq6.ipv6mr_multiaddr, &(((struct sockaddr_in6 *)addr)->sin6_addr), sizeof(struct in6_addr));
         mreq6.ipv6mr_interface= 0;
         if (setsockopt(sockfd, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, &mreq6, sizeof(mreq6)) < 0) {
-            perror("setsockopt(IPV6_ADD_MEMBERSHIP)");
+            av_log(NULL, AV_LOG_ERROR, "setsockopt(IPV6_ADD_MEMBERSHIP): %s\n", strerror(errno));
             return -1;
         }
     }
@@ -100,7 +100,7 @@
         mreq.imr_multiaddr.s_addr = ((struct sockaddr_in *)addr)->sin_addr.s_addr;
         mreq.imr_interface.s_addr= INADDR_ANY;
         if (setsockopt(sockfd, IPPROTO_IP, IP_DROP_MEMBERSHIP, (const void *)&mreq, sizeof(mreq)) < 0) {
-            perror("setsockopt(IP_DROP_MEMBERSHIP)");
+            av_log(NULL, AV_LOG_ERROR, "setsockopt(IP_DROP_MEMBERSHIP): %s\n", strerror(errno));
             return -1;
         }
     }
@@ -112,7 +112,7 @@
         memcpy(&mreq6.ipv6mr_multiaddr, &(((struct sockaddr_in6 *)addr)->sin6_addr), sizeof(struct in6_addr));
         mreq6.ipv6mr_interface= 0;
         if (setsockopt(sockfd, IPPROTO_IPV6, IPV6_DROP_MEMBERSHIP, &mreq6, sizeof(mreq6)) < 0) {
-            perror("setsockopt(IPV6_DROP_MEMBERSHIP)");
+            av_log(NULL, AV_LOG_ERROR, "setsockopt(IPV6_DROP_MEMBERSHIP): %s\n", strerror(errno));
             return -1;
         }
     }
@@ -172,7 +172,7 @@
     for (res = res0; res; res=res->ai_next) {
         udp_fd = socket(res->ai_family, SOCK_DGRAM, 0);
         if (udp_fd > 0) break;
-        perror("socket");
+        av_log(NULL, AV_LOG_ERROR, "socket: %s\n", strerror(errno));
     }
 
     if (udp_fd < 0)
@@ -199,7 +199,7 @@
     char hbuf[NI_MAXHOST];
 
     if (getnameinfo((struct sockaddr *)addr, addr_len, hbuf, sizeof(hbuf),  sbuf, sizeof(sbuf), NI_NUMERICHOST | NI_NUMERICSERV) != 0) {
-        perror("getnameinfo");
+        av_log(NULL, AV_LOG_ERROR, "getnameinfo: %s\n", strerror(errno));
         return -1;
     }
 
@@ -389,7 +389,7 @@
         /* limit the tx buf size to limit latency */
         tmp = UDP_TX_BUF_SIZE;
         if (setsockopt(udp_fd, SOL_SOCKET, SO_SNDBUF, &tmp, sizeof(tmp)) < 0) {
-            perror("setsockopt sndbuf");
+            av_log(NULL, AV_LOG_ERROR, "setsockopt(SO_SNDBUF): %s\n", strerror(errno));
             goto fail;
         }
     } else {