X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fmisc%2Fmessages.c;h=ce71533f661c48e95fd4c124d5c58ece90ce7364;hb=6add489cc23d8c2a57e39ae5dbc1475ba982edc7;hp=874a2d4133dabbc26bff4389574a071c550f7f2e;hpb=2bbcd7df7d1cd88f167705d0b4ac67768706ac04;p=vlc diff --git a/src/misc/messages.c b/src/misc/messages.c index 874a2d4133..ce71533f66 100644 --- a/src/misc/messages.c +++ b/src/misc/messages.c @@ -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 );