]> git.sesse.net Git - vlc/blobdiff - src/misc/messages.c
fix compilation on Linux
[vlc] / src / misc / messages.c
index 874a2d4133dabbc26bff4389574a071c550f7f2e..ce71533f661c48e95fd4c124d5c58ece90ce7364 100644 (file)
@@ -367,7 +367,20 @@ static void QueueMsg( vlc_object_t *p_this, int i_queue, int i_type,
 
     if( psz_str == NULL )
     {
-        fputs( "main warning: no memory to store message): ", stderr );
+#ifdef __GLIBC__
+        fprintf( stderr, "main warning: can't store message (%m): " );
+#else
+        char *psz_err[1001];
+#ifndef WIN32
+        /* we're not using GLIBC, so we are sure that the error description
+         * will be stored in the buffer we provide to strerror_r() */
+        strerror_r( errno, psz_err, 1001 );
+#else
+        strncpy( psz_err, strerror( errno ), 1001 );
+#endif
+        psz_err[1000] = '\0';
+        fprintf( stderr, "main warning: can't store message (%s): ", psz_err );
+#endif
         vlc_va_copy( args, _args );
         /* We should use utf8_vfprintf - but it calls malloc()... */
         vfprintf( stderr, psz_format, args );