#include <stdlib.h>
#include <stdarg.h>
-#include <string.h> /* strerror() */
+#include <string.h>
#include <stdio.h>
#ifdef HAVE_SYS_TYPES_H
# endif
# include <netdb.h>
# define net_errno errno
-# define net_strerror strerror
#endif
# ifdef __cplusplus
int i_result;
/* In case of error : */
unsigned long int i_thread = 0;
- const char * psz_error = "";
#if defined( PTH_INIT_IN_PTH_H )
i_result = ( pth_mutex_acquire( &p_mutex->mutex, FALSE, NULL ) == FALSE );
if ( i_result )
{
i_thread = CAST_PTHREAD_TO_INT(pthread_self());
- psz_error = strerror(i_result);
+ errno = i_result;
}
#elif defined( HAVE_CTHREADS_H )
if( i_result )
{
msg_Err( p_mutex->p_this,
- "thread %li: mutex_lock failed at %s:%d (%d:%s)",
- i_thread, psz_file, i_line, i_result, psz_error );
+ "thread %li: mutex_lock failed at %s:%d (%d:%m)",
+ i_thread, psz_file, i_line, i_result );
}
return i_result;
}
int i_result;
/* In case of error : */
unsigned long int i_thread = 0;
- const char * psz_error = "";
#if defined( PTH_INIT_IN_PTH_H )
i_result = ( pth_mutex_release( &p_mutex->mutex ) == FALSE );
if ( i_result )
{
i_thread = CAST_PTHREAD_TO_INT(pthread_self());
- psz_error = strerror(i_result);
+ errno = i_result;
}
#elif defined( HAVE_CTHREADS_H )
if( i_result )
{
msg_Err( p_mutex->p_this,
- "thread %li: mutex_unlock failed at %s:%d (%d:%s)",
- i_thread, psz_file, i_line, i_result, psz_error );
+ "thread %li: mutex_unlock failed at %s:%d (%d:%m)",
+ i_thread, psz_file, i_line, i_result );
}
return i_result;
int i_result;
/* In case of error : */
unsigned long int i_thread = 0;
- const char * psz_error = "";
#if defined( PTH_INIT_IN_PTH_H )
i_result = ( pth_cond_notify( &p_condvar->cond, FALSE ) == FALSE );
if ( i_result )
{
i_thread = CAST_PTHREAD_TO_INT(pthread_self());
- psz_error = strerror(i_result);
+ errno = i_result;
}
#elif defined( HAVE_CTHREADS_H )
if( i_result )
{
msg_Err( p_condvar->p_this,
- "thread %li: cond_signal failed at %s:%d (%d:%s)",
- i_thread, psz_file, i_line, i_result, psz_error );
+ "thread %li: cond_signal failed at %s:%d (%d:%m)",
+ i_thread, psz_file, i_line, i_result );
}
return i_result;
int i_result;
/* In case of error : */
unsigned long int i_thread = 0;
- const char * psz_error = "";
#if defined( PTH_INIT_IN_PTH_H )
i_result = ( pth_cond_await( &p_condvar->cond, &p_mutex->mutex, NULL )
if( i_result == ETIMEDOUT )
{
+ errno = ETIMEDOUT;
msg_Dbg( p_condvar->p_this,
"thread %li: possible condition deadlock "
- "at %s:%d (%s)", CAST_PTHREAD_TO_INT(pthread_self()),
- psz_file, i_line, strerror(i_result) );
+ "at %s:%d (%m)", CAST_PTHREAD_TO_INT(pthread_self()),
+ psz_file, i_line );
i_result = pthread_cond_wait( &p_condvar->cond, &p_mutex->mutex );
}
if ( i_result )
{
i_thread = CAST_PTHREAD_TO_INT(pthread_self());
- psz_error = strerror(i_result);
+ errno = i_result;
}
#elif defined( HAVE_CTHREADS_H )
if( i_result )
{
msg_Err( p_condvar->p_this,
- "thread %li: cond_wait failed at %s:%d (%d:%s)",
- i_thread, psz_file, i_line, i_result, psz_error );
+ "thread %li: cond_wait failed at %s:%d (%d:%m)",
+ i_thread, psz_file, i_line, i_result );
}
return i_result;
{
int i_res;
unsigned long int i_thread = 0;
- const char * psz_error = "";
#if defined( PTH_INIT_IN_PTH_H )
# error Unimplemented
if ( i_res ) /* other errors = bug */
{
i_thread = CAST_PTHREAD_TO_INT(pthread_self());
- psz_error = strerror(i_res);
+ errno = i_res;
}
#elif defined( HAVE_CTHREADS_H )
if( i_res )
{
msg_Err( p_condvar->p_this,
- "thread %li: cond_wait failed at %s:%d (%d:%s)",
- i_thread, psz_file, i_line, i_res, psz_error );
+ "thread %li: cond_wait failed at %s:%d (%d:%m)",
+ i_thread, psz_file, i_line, i_res );
}
return i_res;
stream_Delete( p_stream );
if( err )
- msg_Err( p_playlist, "%s: %s", psz_filename, strerror( err ) );
+ {
+ errno = err;
+ msg_Err( p_playlist, "%s: %m", psz_filename );
+ }
else
msg_Dbg( p_playlist, "album art saved to %s\n", psz_filename );
if( f )
{
if( fwrite( p_attachment->p_data, p_attachment->i_data, 1, f ) != 1 )
- msg_Err( p_input, "%s: %s", psz_filename, strerror( errno ) );
+ msg_Err( p_input, "%s: %m", psz_filename );
else
msg_Dbg( p_input, "album art saved to %s\n", psz_filename );
fclose( f );
int i_result;
/* In case of error : */
int i_thread = -1;
- const char * psz_error = "";
#if defined( PTH_INIT_IN_PTH_H )
return 0;
if( i_result )
{
i_thread = CAST_PTHREAD_TO_INT(pthread_self());
- psz_error = strerror(i_result);
+ errno = i_result;
}
#elif defined( HAVE_CTHREADS_H )
if( i_result )
{
msg_Err( p_mutex->p_this,
- "thread %d: mutex_destroy failed at %s:%d (%d:%s)",
- i_thread, psz_file, i_line, i_result, psz_error );
+ "thread %d: mutex_destroy failed at %s:%d (%d:%m)",
+ i_thread, psz_file, i_line, i_result );
}
return i_result;
}
int i_result;
/* In case of error : */
int i_thread = -1;
- const char * psz_error = "";
#if defined( PTH_INIT_IN_PTH_H )
return 0;
if( i_result )
{
i_thread = CAST_PTHREAD_TO_INT(pthread_self());
- psz_error = strerror(i_result);
+ errno = i_result;
}
#elif defined( HAVE_CTHREADS_H )
if( i_result )
{
msg_Err( p_condvar->p_this,
- "thread %d: cond_destroy failed at %s:%d (%d:%s)",
- i_thread, psz_file, i_line, i_result, psz_error );
+ "thread %d: cond_destroy failed at %s:%d (%d:%m)",
+ i_thread, psz_file, i_line, i_result );
}
return i_result;
}
if( (i_error = pthread_setschedparam( p_priv->thread_id,
i_policy, ¶m )) )
{
- msg_Warn( p_this, "couldn't set thread priority (%s:%d): %s",
- psz_file, i_line, strerror(i_error) );
+ errno = i_error;
+ msg_Warn( p_this, "couldn't set thread priority (%s:%d): %m",
+ psz_file, i_line );
i_priority = 0;
}
}
}
else
{
- msg_Err( p_this, "%s thread could not be created at %s:%d (%s)",
- psz_name, psz_file, i_line, strerror(i_ret) );
+ errno = i_ret;
+ msg_Err( p_this, "%s thread could not be created at %s:%d (%m)",
+ psz_name, psz_file, i_line );
vlc_mutex_unlock( &p_this->object_lock );
}
if( (i_error = pthread_setschedparam( p_priv->thread_id,
i_policy, ¶m )) )
{
- msg_Warn( p_this, "couldn't set thread priority (%s:%d): %s",
- psz_file, i_line, strerror(i_error) );
+ errno = i_error;
+ msg_Warn( p_this, "couldn't set thread priority (%s:%d): %m",
+ psz_file, i_line );
i_priority = 0;
}
}
if( i_ret )
{
- msg_Err( p_this, "thread_join(%u) failed at %s:%d (%s)",
- (unsigned int)p_priv->thread_id, psz_file, i_line,
- strerror(i_ret) );
+ errno = i_ret;
+ msg_Err( p_this, "thread_join(%u) failed at %s:%d (%m)",
+ (unsigned int)p_priv->thread_id, psz_file, i_line );
}
else
{
{
if( ferror( file ) )
{
- msg_Err( p_acl->p_owner, "error reading %s : %s\n", psz_path,
- strerror( errno ) );
+ msg_Err( p_acl->p_owner, "error reading %s : %m", psz_path );
goto error;
}
continue;
ptr = strchr( psz_ip, '\n' );
if( ptr == NULL )
{
- msg_Warn( p_acl->p_owner, "skipping overly long line in %s\n",
+ msg_Warn( p_acl->p_owner, "skipping overly long line in %s",
psz_path);
do
{
{
if( ferror( file ) )
{
- msg_Err( p_acl->p_owner, "error reading %s : %s\n",
- psz_path, strerror( errno ) );
+ msg_Err( p_acl->p_owner, "error reading %s : %m",
+ psz_path );
}
goto error;
}
if (errno != EINTR)
{
/* This is most likely a bug */
- msg_Err( host, "polling error: %s", strerror (errno));
+ msg_Err( host, "polling error: %m" );
msleep( 1000 );
}
case 0:
if (fd == -1)
{
if (net_errno != EAFNOSUPPORT)
- msg_Err (p_this, "cannot create socket: %s",
- net_strerror (net_errno));
+ msg_Err (p_this, "cannot create socket: %m");
return -1;
}
protocol ?: ptr->ai_protocol);
if (fd == -1)
{
- msg_Dbg (p_this, "socket error: %s", net_strerror (net_errno));
+ msg_Dbg (p_this, "socket error: %m");
continue;
}
#endif
if (bind (fd, ptr->ai_addr, ptr->ai_addrlen))
{
- int saved_errno = net_errno;
-
net_Close (fd);
#if !defined(WIN32) && !defined(UNDER_CE)
fd = rootwrap_bind (ptr->ai_family, ptr->ai_socktype,
else
#endif
{
- msg_Err (p_this, "socket bind error (%s)",
- net_strerror( saved_errno ) );
+ msg_Err (p_this, "socket bind error (%m)");
continue;
}
}
#endif
if (listen (fd, INT_MAX))
{
- msg_Err (p_this, "socket listen error (%s)",
- net_strerror (net_errno));
+ msg_Err (p_this, "socket listen error (%m)");
net_Close (fd);
continue;
}
return i_total;
error:
- msg_Err (p_this, "Read error: %s", net_strerror (net_errno));
+ msg_Err (p_this, "Read error: %m");
return i_total ? (ssize_t)i_total : -1;
}
switch (val)
{
case -1:
- msg_Err (p_this, "Write error: %s", net_strerror (net_errno));
+ msg_Err (p_this, "Write error: %m");
goto out;
case 0:
if (val == -1)
{
- msg_Err (p_this, "Write error: %s", net_strerror (net_errno));
+ msg_Err (p_this, "Write error: %m");
break;
}
proto ?: ptr->ai_protocol );
if( fd == -1 )
{
- msg_Dbg( p_this, "socket error: %s", strerror( net_errno ) );
+ msg_Dbg( p_this, "socket error: %m" );
continue;
}
if( net_errno != EINPROGRESS )
{
- msg_Err( p_this, "connection failed: %s",
- strerror( net_errno ) );
+ msg_Err( p_this, "connection failed: %m" );
goto next_ai;
}
if( ( i_ret == -1 ) && ( net_errno != EINTR ) )
{
- msg_Err( p_this, "connection polling error: %s",
- strerror( net_errno ) );
+ msg_Err( p_this, "connection polling error: %m" );
goto next_ai;
}
if( getsockopt( fd, SOL_SOCKET, SO_ERROR, (void*)&i_val,
&i_val_size ) == -1 || i_val != 0 )
{
- msg_Err( p_this, "connection failed: %s",
- net_strerror( i_val ) );
+ msg_Err( p_this, "connection failed: %m" );
goto next_ai;
}
#endif
case -1:
if (net_errno != EINTR)
{
- msg_Err (p_this, "poll error: %s",
- net_strerror (net_errno));
+ msg_Err (p_this, "poll error: %m");
}
return -1;
int fd = accept (sfd, NULL, NULL);
if (fd == -1)
{
- msg_Err (p_this, "accept failed (%s)",
- net_strerror (net_errno));
+ msg_Err (p_this, "accept failed (%m)");
continue;
}
net_SetupSocket (fd);
protocol ?: ptr->ai_protocol);
if (fd == -1)
{
- msg_Dbg (obj, "socket error: %s", net_strerror (net_errno));
+ msg_Dbg (obj, "socket error: %m");
continue;
}
#endif
if (bind (fd, ptr->ai_addr, ptr->ai_addrlen))
{
- msg_Err (obj, "socket bind error (%s)", net_strerror (net_errno));
+ msg_Err (obj, "socket bind error (%m)");
net_Close (fd);
continue;
}
#endif
default:
- msg_Warn( p_this, "%s", strerror( EAFNOSUPPORT ) );
+ errno = EAFNOSUPPORT;
+ msg_Warn( p_this, "%m" );
return VLC_EGENERIC;
}
if (net_SetMcastOutIface (fd, family, scope) == 0)
return 0;
- msg_Err (p_this, "%s: %s", iface, net_strerror (net_errno));
+ msg_Err (p_this, "%s: %m", iface);
}
if (addr != NULL)
if (net_SetMcastOutIPv4 (fd, ipv4) == 0)
return 0;
- msg_Err (p_this, "%s: %s", addr, net_strerror (net_errno));
+ msg_Err (p_this, "%s: %m", addr);
}
}
error:
#endif
- msg_Err (obj, "cannot join IPv4 multicast group (%s)",
- net_strerror (net_errno));
+ msg_Err (obj, "cannot join IPv4 multicast group (%m)");
return -1;
}
errno = ENOSYS;
#endif
- msg_Err (obj, "cannot join IPv6 any-source multicast group (%s)",
- net_strerror (net_errno));
+ msg_Err (obj, "cannot join IPv6 any-source multicast group (%m)");
return -1;
}
#endif
}
- msg_Err (obj, "Multicast group join error (%s)",
- net_strerror (net_errno));
+ msg_Err (obj, "Multicast group join error (%m)");
if (src != NULL)
{
b_unreach = VLC_TRUE;
else
{
- msg_Warn( p_this, "%s port %d : %s", psz_host, i_port,
- strerror( errno ) );
+ msg_Warn( p_this, "%s port %d : %m", psz_host, i_port);
net_Close( fd );
continue;
}
ptr->ai_addr, ptr->ai_addrlen)
: connect (fd, ptr2->ai_addr, ptr2->ai_addrlen))
{
- msg_Err (obj, "cannot connect to %s port %d: %s",
- psz_server, i_server, net_strerror (net_errno));
+ msg_Err (obj, "cannot connect to %s port %d: %m",
+ psz_server, i_server);
continue;
}
val = fd;
#include <stdlib.h> /* free() */
#include <stdio.h> /* sprintf() */
-#include <string.h> /* strerror() */
+#include <string.h>
#include <ctype.h> /* tolower(), isxdigit() */
#include <vlc_sout.h>
#include <stdlib.h> /* free() */
#include <stdio.h> /* sprintf() */
-#include <string.h> /* strerror() */
+#include <string.h>
#include <vlc_sout.h>
#include <vlc_playlist.h>