[vlc-commits] RTP: use vlc_strerror_c()

Rémi Denis-Courmont git at videolan.org
Sun Dec 29 15:16:28 CET 2013


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Dec 28 19:54:16 2013 +0200| [cabc65677ed25f9b01bedaf656d581b191bbfaeb] | committer: Rémi Denis-Courmont

RTP: use vlc_strerror_c()

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cabc65677ed25f9b01bedaf656d581b191bbfaeb
---

 modules/access/rtp/input.c |    4 +++-
 modules/access/rtp/rtp.c   |    8 ++++----
 modules/stream_out/rtp.c   |   15 ++++++++-------
 3 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/modules/access/rtp/input.c b/modules/access/rtp/input.c
index 18dac00..5397649 100644
--- a/modules/access/rtp/input.c
+++ b/modules/access/rtp/input.c
@@ -30,6 +30,7 @@
 #include <vlc_network.h>
 
 #include <limits.h>
+#include <errno.h>
 #include <unistd.h>
 #ifdef HAVE_POLL
 # include <poll.h>
@@ -136,7 +137,8 @@ void *rtp_dgram_thread (void *opaque)
             }
             else
             {
-                msg_Warn (demux, "RTP network error: %m");
+                msg_Warn (demux, "RTP network error: %s",
+                          vlc_strerror_c(errno));
                 block_Release (block);
             }
         }
diff --git a/modules/access/rtp/rtp.c b/modules/access/rtp/rtp.c
index 1936129..455c0e8 100644
--- a/modules/access/rtp/rtp.c
+++ b/modules/access/rtp/rtp.c
@@ -26,7 +26,6 @@
 #endif
 #include <stdarg.h>
 #include <assert.h>
-#include <errno.h>
 
 #include <vlc_common.h>
 #include <vlc_demux.h>
@@ -290,12 +289,13 @@ static int Open (vlc_object_t *obj)
         }
 
         char *salt = var_CreateGetNonEmptyString (demux, "srtp-salt");
-        errno = srtp_setkeystring (p_sys->srtp, key, salt ? salt : "");
+        int val = srtp_setkeystring (p_sys->srtp, key, salt ? salt : "");
         free (salt);
         free (key);
-        if (errno)
+        if (val)
         {
-            msg_Err (obj, "bad SRTP key/salt combination (%m)");
+            msg_Err (obj, "bad SRTP key/salt combination (%s)",
+                     vlc_strerror_c(val));
             goto error;
         }
     }
diff --git a/modules/stream_out/rtp.c b/modules/stream_out/rtp.c
index 62c89b7..68a5f07 100644
--- a/modules/stream_out/rtp.c
+++ b/modules/stream_out/rtp.c
@@ -1039,12 +1039,13 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
         }
 
         char *salt = var_GetNonEmptyString (p_stream, SOUT_CFG_PREFIX"salt");
-        errno = srtp_setkeystring (id->srtp, key, salt ? salt : "");
+        int val = srtp_setkeystring (id->srtp, key, salt ? salt : "");
         free (salt);
         free (key);
-        if (errno)
+        if (val)
         {
-            msg_Err (p_stream, "bad SRTP key/salt combination (%m)");
+            msg_Err (p_stream, "bad SRTP key/salt combination (%s)",
+                     vlc_strerror_c(val));
             goto error;
         }
         id->i_sequence = 0; /* FIXME: awful hack for libvlc_srtp */
@@ -1329,8 +1330,8 @@ static int FileSetup( sout_stream_t *p_stream )
 
     if( ( f = vlc_fopen( p_sys->psz_sdp_file, "wt" ) ) == NULL )
     {
-        msg_Err( p_stream, "cannot open file '%s' (%m)",
-                 p_sys->psz_sdp_file );
+        msg_Err( p_stream, "cannot open file '%s' (%s)",
+                 p_sys->psz_sdp_file, vlc_strerror_c(errno) );
         return VLC_EGENERIC;
     }
 
@@ -1421,8 +1422,8 @@ static void* ThreadSend( void *data )
             vlc_restorecancel (canc);
             if( val )
             {
-                errno = val;
-                msg_Dbg( id->p_stream, "SRTP sending error: %m" );
+                msg_Dbg( id->p_stream, "SRTP sending error: %s",
+                         vlc_strerror_c(val) );
                 block_Release( out );
                 out = NULL;
             }



More information about the vlc-commits mailing list