]> git.sesse.net Git - vlc/blobdiff - src/network/udp.c
sout: remove impossible NULL check followed by reverse NULL
[vlc] / src / network / udp.c
index c02da8c6e1084bcdc8212b41923dbbd3d6d3ea99..b2c8a501ad30bbf4197705cfa199ca31bd5e1566 100644 (file)
@@ -113,7 +113,7 @@ static int net_SetupDgramSocket (vlc_object_t *p_obj, int fd,
 #endif
     if (bind (fd, ptr->ai_addr, ptr->ai_addrlen))
     {
-        msg_Err( p_obj, "socket bind error (%m)" );
+        msg_Err( p_obj, "socket bind error: %s", vlc_strerror_c(net_errno) );
         net_Close (fd);
         return -1;
     }
@@ -152,7 +152,7 @@ static int net_ListenSingle (vlc_object_t *obj, const char *host, int port,
                              ptr->ai_protocol);
         if (fd == -1)
         {
-            msg_Dbg (obj, "socket error: %m");
+            msg_Dbg (obj, "socket error: %s", vlc_strerror_c(net_errno));
             continue;
         }
 
@@ -208,7 +208,7 @@ static int net_SetMcastHopLimit( vlc_object_t *p_this,
 
         default:
             errno = EAFNOSUPPORT;
-            msg_Warn( p_this, "%m" );
+            msg_Warn( p_this, "%s", vlc_strerror_c(EAFNOSUPPORT) );
             return VLC_EGENERIC;
     }
 
@@ -217,11 +217,13 @@ static int net_SetMcastHopLimit( vlc_object_t *p_this,
         /* BSD compatibility */
         unsigned char buf;
 
-        msg_Dbg( p_this, "cannot set hop limit (%d): %m", hlim );
+        msg_Dbg( p_this, "cannot set hop limit (%d): %s", hlim,
+                 vlc_strerror_c(net_errno) );
         buf = (unsigned char)(( hlim > 255 ) ? 255 : hlim);
         if( setsockopt( fd, proto, cmd, &buf, sizeof( buf ) ) )
         {
-            msg_Err( p_this, "cannot set hop limit (%d): %m", hlim );
+            msg_Err( p_this, "cannot set hop limit (%d): %s", hlim,
+                     vlc_strerror_c(net_errno) );
             return VLC_EGENERIC;
         }
     }
@@ -263,7 +265,8 @@ static int net_SetMcastOut (vlc_object_t *p_this, int fd, int family,
         default:
             errno = EAFNOSUPPORT;
     }
-    msg_Err (p_this, "cannot force multicast interface %s: %m", iface);
+    msg_Err (p_this, "cannot force multicast interface %s: %s", iface,
+             vlc_strerror_c(errno));
     return -1;
 }
 
@@ -291,7 +294,9 @@ net_SourceSubscribe (vlc_object_t *obj, int fd,
                      const struct sockaddr *src, socklen_t srclen,
                      const struct sockaddr *grp, socklen_t grplen)
 {
-#ifdef MCAST_JOIN_SOURCE_GROUP
+/* MCAST_JOIN_SOURCE_GROUP was introduced to OS X in v10.7, but it doesn't work,
+ * so ignore it to use the same code path as on 10.5 or 10.6 */
+#if defined (MCAST_JOIN_SOURCE_GROUP) && !defined (__APPLE__)
     /* Agnostic SSM multicast join */
     int level;
     struct group_source_req gsr;
@@ -360,7 +365,8 @@ net_SourceSubscribe (vlc_object_t *obj, int fd,
     }
 
 #endif
-    msg_Err (obj, "cannot join source multicast group: %m");
+    msg_Err (obj, "cannot join source multicast group: %s",
+             vlc_strerror_c(net_errno));
     msg_Warn (obj, "trying ASM instead of SSM...");
     return net_Subscribe (obj, fd, grp, grplen);
 }
@@ -444,7 +450,8 @@ int net_Subscribe (vlc_object_t *obj, int fd,
     }
 
 #endif
-    msg_Err (obj, "cannot join multicast group: %m");
+    msg_Err (obj, "cannot join multicast group: %s",
+             vlc_strerror_c(net_errno));
     return -1;
 }
 
@@ -549,7 +556,8 @@ int net_ConnectDgram( vlc_object_t *p_this, const char *psz_host, int i_port,
 #endif
             b_unreach = true;
         else
-            msg_Warn( p_this, "%s port %d : %m", psz_host, i_port);
+            msg_Warn( p_this, "%s port %d : %s", psz_host, i_port,
+                      vlc_strerror_c(errno) );
         net_Close( fd );
     }
 
@@ -630,8 +638,8 @@ int net_OpenDgram( vlc_object_t *obj, const char *psz_bind, int i_bind,
                                      ptr->ai_addr, ptr->ai_addrlen)
               : connect (fd, ptr2->ai_addr, ptr2->ai_addrlen))
             {
-                msg_Err (obj, "cannot connect to %s port %d: %m",
-                         psz_server, i_server);
+                msg_Err (obj, "cannot connect to %s port %d: %s",
+                         psz_server, i_server, vlc_strerror_c(net_errno));
                 continue;
             }
             val = fd;