Commit a059cf56 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

file: use vlc_strerror()

This fixes "%m" in error dialogs on non-GNU platforms.
parent 9ff28119
...@@ -172,9 +172,11 @@ int FileOpen( vlc_object_t *p_this ) ...@@ -172,9 +172,11 @@ int FileOpen( vlc_object_t *p_this )
fd = vlc_open (path, O_RDONLY | O_NONBLOCK); fd = vlc_open (path, O_RDONLY | O_NONBLOCK);
if (fd == -1) if (fd == -1)
{ {
msg_Err (p_access, "cannot open file %s (%m)", path); msg_Err (p_access, "cannot open file %s (%s)", path,
vlc_strerror_c(errno));
dialog_Fatal (p_access, _("File reading failed"), dialog_Fatal (p_access, _("File reading failed"),
_("VLC could not open the file \"%s\" (%m)."), path); _("VLC could not open the file \"%s\" (%s)."), path,
vlc_strerror(errno));
} }
} }
if (fd == -1) if (fd == -1)
...@@ -183,7 +185,7 @@ int FileOpen( vlc_object_t *p_this ) ...@@ -183,7 +185,7 @@ int FileOpen( vlc_object_t *p_this )
struct stat st; struct stat st;
if (fstat (fd, &st)) if (fstat (fd, &st))
{ {
msg_Err (p_access, "failed to read (%m)"); msg_Err (p_access, "read error: %s", vlc_strerror_c(errno));
goto error; goto error;
} }
...@@ -295,9 +297,10 @@ static ssize_t FileRead (access_t *p_access, uint8_t *p_buffer, size_t i_len) ...@@ -295,9 +297,10 @@ static ssize_t FileRead (access_t *p_access, uint8_t *p_buffer, size_t i_len)
return -1; return -1;
} }
msg_Err (p_access, "read error: %m"); msg_Err (p_access, "read error: %s", vlc_strerror_c(errno));
dialog_Fatal (p_access, _("File reading failed"), dialog_Fatal (p_access, _("File reading failed"),
_("VLC could not read the file (%m).")); _("VLC could not read the file (%s)."),
vlc_strerror(errno));
val = 0; val = 0;
} }
...@@ -348,7 +351,7 @@ static ssize_t StreamRead (access_t *p_access, uint8_t *p_buffer, size_t i_len) ...@@ -348,7 +351,7 @@ static ssize_t StreamRead (access_t *p_access, uint8_t *p_buffer, size_t i_len)
case EAGAIN: case EAGAIN:
return -1; return -1;
} }
msg_Err (p_access, "read error: %m"); msg_Err (p_access, "read error: %s", vlc_strerror_c(errno));
val = 0; val = 0;
} }
......
...@@ -149,7 +149,8 @@ static int Open( vlc_object_t *p_this ) ...@@ -149,7 +149,8 @@ static int Open( vlc_object_t *p_this )
fd = vlc_dup (fd); fd = vlc_dup (fd);
if (fd == -1) if (fd == -1)
{ {
msg_Err (p_access, "cannot use file descriptor: %m"); msg_Err (p_access, "cannot use file descriptor: %s",
vlc_strerror_c(errno));
return VLC_EGENERIC; return VLC_EGENERIC;
} }
} }
...@@ -162,7 +163,8 @@ static int Open( vlc_object_t *p_this ) ...@@ -162,7 +163,8 @@ static int Open( vlc_object_t *p_this )
fd = vlc_dup (STDOUT_FILENO); fd = vlc_dup (STDOUT_FILENO);
if (fd == -1) if (fd == -1)
{ {
msg_Err (p_access, "cannot use standard output: %m"); msg_Err (p_access, "cannot use standard output: %s",
vlc_strerror_c(errno));
return VLC_EGENERIC; return VLC_EGENERIC;
} }
msg_Dbg( p_access, "using stdout" ); msg_Dbg( p_access, "using stdout" );
...@@ -194,7 +196,8 @@ static int Open( vlc_object_t *p_this ) ...@@ -194,7 +196,8 @@ static int Open( vlc_object_t *p_this )
if (fd != -1) if (fd != -1)
break; break;
if (fd == -1) if (fd == -1)
msg_Err (p_access, "cannot create %s: %m", path); msg_Err (p_access, "cannot create %s: %s", path,
vlc_strerror_c(errno));
if (overwrite || errno != EEXIST) if (overwrite || errno != EEXIST)
break; break;
flags &= ~O_EXCL; flags &= ~O_EXCL;
...@@ -293,7 +296,7 @@ static ssize_t Write( sout_access_out_t *p_access, block_t *p_buffer ) ...@@ -293,7 +296,7 @@ static ssize_t Write( sout_access_out_t *p_access, block_t *p_buffer )
if (errno == EINTR) if (errno == EINTR)
continue; continue;
block_ChainRelease (p_buffer); block_ChainRelease (p_buffer);
msg_Err( p_access, "cannot write: %m" ); msg_Err( p_access, "cannot write: %s", vlc_strerror_c(errno) );
return -1; return -1;
} }
......
...@@ -30,6 +30,9 @@ ...@@ -30,6 +30,9 @@
# include "config.h" # include "config.h"
#endif #endif
#include <stdio.h>
#include <errno.h>
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_plugin.h> #include <vlc_plugin.h>
#include <vlc_aout.h> #include <vlc_aout.h>
...@@ -254,7 +257,7 @@ static int Start( audio_output_t *p_aout, audio_sample_format_t *restrict fmt ) ...@@ -254,7 +257,7 @@ static int Start( audio_output_t *p_aout, audio_sample_format_t *restrict fmt )
if( fwrite( wh, sizeof(WAVEHEADER), 1, if( fwrite( wh, sizeof(WAVEHEADER), 1,
p_aout->sys->p_file ) != 1 ) p_aout->sys->p_file ) != 1 )
{ {
msg_Err( p_aout, "write error (%m)" ); msg_Err( p_aout, "write error: %s", vlc_strerror_c(errno) );
} }
} }
...@@ -277,7 +280,7 @@ static void Stop( audio_output_t *p_aout ) ...@@ -277,7 +280,7 @@ static void Stop( audio_output_t *p_aout )
/* Write Wave Header */ /* Write Wave Header */
if( fseek( p_aout->sys->p_file, 0, SEEK_SET ) ) if( fseek( p_aout->sys->p_file, 0, SEEK_SET ) )
{ {
msg_Err( p_aout, "seek error (%m)" ); msg_Err( p_aout, "seek error: %s", vlc_strerror_c(errno) );
} }
/* Header -> little endian format */ /* Header -> little endian format */
...@@ -289,7 +292,7 @@ static void Stop( audio_output_t *p_aout ) ...@@ -289,7 +292,7 @@ static void Stop( audio_output_t *p_aout )
if( fwrite( &p_aout->sys->waveh, sizeof(WAVEHEADER), 1, if( fwrite( &p_aout->sys->waveh, sizeof(WAVEHEADER), 1,
p_aout->sys->p_file ) != 1 ) p_aout->sys->p_file ) != 1 )
{ {
msg_Err( p_aout, "write error (%m)" ); msg_Err( p_aout, "write error: %s", vlc_strerror_c(errno) );
} }
} }
...@@ -306,7 +309,7 @@ static void Play( audio_output_t * p_aout, block_t *p_buffer ) ...@@ -306,7 +309,7 @@ static void Play( audio_output_t * p_aout, block_t *p_buffer )
if( fwrite( p_buffer->p_buffer, p_buffer->i_buffer, 1, if( fwrite( p_buffer->p_buffer, p_buffer->i_buffer, 1,
p_aout->sys->p_file ) != 1 ) p_aout->sys->p_file ) != 1 )
{ {
msg_Err( p_aout, "write error (%m)" ); msg_Err( p_aout, "write error: %s", vlc_strerror_c(errno) );
} }
if( p_aout->sys->b_add_wav_header ) if( p_aout->sys->b_add_wav_header )
...@@ -321,7 +324,7 @@ static void Play( audio_output_t * p_aout, block_t *p_buffer ) ...@@ -321,7 +324,7 @@ static void Play( audio_output_t * p_aout, block_t *p_buffer )
static void Flush( audio_output_t *aout, bool wait ) static void Flush( audio_output_t *aout, bool wait )
{ {
if( fflush( aout->sys->p_file ) ) if( fflush( aout->sys->p_file ) )
msg_Err( aout, "flush error (%m)" ); msg_Err( aout, "flush error: %s", vlc_strerror_c(errno) );
(void) wait; (void) wait;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment