1
0
mirror of http://mpg123.de/trunk/.git synced 2025-08-09 08:22:45 +03:00

always use INT123_strerror() wrapper that tries to do the threadsafe thing

git-svn-id: svn://scm.orgis.org/mpg123/trunk@5321 35dc7657-300d-0410-a2e5-dc2837fedb53
This commit is contained in:
thor
2023-09-07 13:25:24 +00:00
parent d0979629b7
commit 8b398fda8e
33 changed files with 99 additions and 94 deletions

1
NEWS
View File

@@ -49,6 +49,7 @@
-- Made mpg123_seek() and friends ignore offset sign for SEEK_END (always seeking
towards beginning, assuming negative offset) to make lseek()-conforming usage
possible. Seeking beyond the end never made sense, so no loss of valid functionality.
- Overall use of INT123_strerror(), trying to use thread-safe strerror_l() if possible.
1.31.3
------

View File

@@ -1320,7 +1320,7 @@ AC_CHECK_FUNCS( sched_setscheduler setuid getuid)
# Check for setpriority
AC_CHECK_FUNCS( setpriority )
AC_CHECK_FUNCS( strerror )
AC_CHECK_FUNCS( strerror strerror_l uselocale )
AC_CHECK_FUNCS( setlocale nl_langinfo mbstowcs wcstombs wcswidth iswprint )

View File

@@ -56,12 +56,14 @@ check_function_exists(random HAVE_RANDOM)
check_function_exists(setenv HAVE_SETENV)
check_function_exists(unsetenv HAVE_UNSETENV)
check_function_exists(setlocale HAVE_SETLOCALE)
check_function_exists(uselocale HAVE_USELOCALE)
check_function_exists(setpriority HAVE_SETPRIORITY)
check_function_exists(shmget HAVE_SHMGET)
check_function_exists(shmat HAVE_SHMAT)
check_function_exists(shmdt HAVE_SHMDT)
check_function_exists(shmctl HAVE_SHMCTL)
check_function_exists(strerror HAVE_STRERROR)
check_function_exists(strerror_l HAVE_STRERROR_L)
check_function_exists(fork HAVE_FORK)
check_function_exists(execvp HAVE_EXECVP)
check_function_exists(ctermid HAVE_CTERMID)

View File

@@ -39,12 +39,14 @@
#cmakedefine HAVE_RANDOM 1
#cmakedefine HAVE_SCHED_H 1
#cmakedefine HAVE_SETLOCALE 1
#cmakedefine HAVE_USELOCALE 1
#cmakedefine HAVE_SETPRIORITY 1
#cmakedefine HAVE_SIGNAL_H 1
#cmakedefine HAVE_STDIO_H 1
#cmakedefine HAVE_STDINT_H 1
#cmakedefine HAVE_STDLIB_H 1
#cmakedefine HAVE_STRERROR 1
#cmakedefine HAVE_STRERROR_L 1
#cmakedefine HAVE_FORK 1
#cmakedefine HAVE_EXECVP 1
#cmakedefine HAVE_CTERMID 1

View File

@@ -35,7 +35,6 @@ src_out123_LDADD = \
src_out123_LDFLAGS = @EXEC_LT_LDFLAGS@
EXTRA_DIST += \
src/intsym.h \
src/version.h \
src/mpg123-with-modules \
src/out123-with-modules

View File

@@ -138,18 +138,13 @@ typedef unsigned char byte;
#include <io.h>
#endif
// Not too early, leave system headers alone (strerror).
#include "intsym.h"
/* A safe realloc also for very old systems where realloc(NULL, size) returns NULL. */
void *INT123_safe_realloc(void *ptr, size_t size);
// Also freeing ptr if result is NULL. You can do
// ptr = INT123_safer_realloc(ptr, size)
// Also, ptr = INT123_safer_realloc(ptr, 0) will do free(ptr); ptr=NULL;.
void *INT123_safer_realloc(void *ptr, size_t size);
#ifndef HAVE_STRERROR
const char *strerror(int errnum);
#endif
const char *INT123_strerror(int errnum);
/* Roll our own strdup() that does not depend on libc feature test macros
and returns NULL on NULL input instead of crashing. */

View File

@@ -4,11 +4,13 @@
The mpg123 code is determined to keep it's legacy. A legacy of old, old UNIX.
So anything possibly somewhat advanced should be considered to be put here, with proper #ifdef;-)
copyright 2007-2016 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright 2007-2023 by the mpg123 project
free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Thomas Orgis, Windows Unicode stuff by JonY.
*/
// Need POSIX 2008 for uselocale stuff.
#define _POSIX_C_SOURCE 200809L
#include "compat.h"
/* Win32 is only supported with unicode now. These headers also cover
@@ -20,6 +22,10 @@
#include <winnls.h>
#endif
#if HAVE_LOCALE_H
#include <locale.h>
#endif
#include "debug.h"
/* A safe realloc also for very old systems where realloc(NULL, size) returns NULL. */
@@ -39,15 +45,23 @@ void *INT123_safer_realloc(void *ptr, size_t size)
return nptr;
}
#ifndef HAVE_STRERROR
const char *strerror(int errnum)
const char *INT123_strerror(int errnum)
{
#if defined(HAVE_STRERROR_L) && defined(HAVE_USELOCALE)
locale_t curloc = uselocale((locale_t)0);
if(curloc != LC_GLOBAL_LOCALE)
return strerror_l(errnum, curloc);
#endif
// Also fall back to strerror() in case of no set locale.
#if defined(HAVE_STRERROR)
return strerror(errnum);
#else
extern int sys_nerr;
extern char *sys_errlist[];
return (errnum < sys_nerr) ? sys_errlist[errnum] : "";
}
#endif
}
char* INT123_compat_strdup(const char *src)
{

View File

@@ -1,7 +1,8 @@
/*
control_generic.c: control interface for frontends and real console warriors
copyright 1997-99,2004-20 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright 1997-99,2004-23 by the mpg123 project
free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Andreas Neuhaus and Michael Hipp
reworked by Thomas Orgis - it was the entry point for eventually becoming maintainer...
@@ -431,7 +432,7 @@ int control_generic (mpg123_handle *fr)
unlink(param.fifo);
if(mkfifo(param.fifo, 0666) == -1)
{
error2("Failed to create FIFO at %s (%s)", param.fifo, strerror(errno));
error2("Failed to create FIFO at %s (%s)", param.fifo, INT123_strerror(errno));
return 1;
}
debug("going to open named pipe ... blocking until someone gives command");
@@ -541,7 +542,7 @@ int control_generic (mpg123_handle *fr)
/* on error */
if(n < 0)
{
merror("waiting for command: %s", strerror(errno));
merror("waiting for command: %s", INT123_strerror(errno));
return 1;
}
/* read & process commands */
@@ -572,11 +573,11 @@ int control_generic (mpg123_handle *fr)
close(control_file);
control_file = open(param.fifo,O_RDONLY|O_NONBLOCK);
#endif
if(control_file < 0){ error1("open of fifo failed... %s", strerror(errno)); break; }
if(control_file < 0){ error1("open of fifo failed... %s", INT123_strerror(errno)); break; }
continue;
}
#endif
if(len < 0) error1("command read error: %s", strerror(errno));
if(len < 0) error1("command read error: %s", INT123_strerror(errno));
break;
}

View File

@@ -1,7 +1,7 @@
/*
filters: parse filter specifications
copyright 2020 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright 2020-2023 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Thomas Orgis
*/
@@ -91,7 +91,7 @@ static int store_filters(struct filterlist *fl, const char *spec)
}
if(errno)
{
merror("Number parsing error on validated spec: %s", strerror(errno));
merror("Number parsing error on validated spec: %s", INT123_strerror(errno));
return -1;
}
if(*spec) // Skip ":"

View File

@@ -1,13 +0,0 @@
#ifndef MPG123_INTSYM_H
#define MPG123_INTSYM_H
// Used to map lots of internal symbols to prefixed names to help static linking,
// reduciton potential naming conflicts. Now only stays here to redirect strerror
// if it does not exist in the system. Might just drop that, though.
// Probably it needs to be replaced by strerror_r() or strerror_s().
#include "config.h"
#ifndef HAVE_STRERROR
#define strerror INT123_strerror
#endif
#endif

View File

@@ -1,3 +1,2 @@
/* Hack to allow building the same code with and without libtool. */
#include "intsym.h"
#include "dither_impl.h"

View File

@@ -1,13 +1,12 @@
/*
icy: Puny code to pretend for a serious ICY data structure.
copyright 2007-2015 by the mpg123 project
copyright 2007-2023 by the mpg123 project
-= free software under the terms of the LGPL 2.1 =-
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Thomas Orgis
*/
#include "intsym.h"
#include "icy.h"
void INT123_init_icy(struct icy_meta *icy)

View File

@@ -27,7 +27,6 @@
*/
#include "config.h"
#include "intsym.h"
/* Includes string and stdlib headers... */
#include "compat.h"

View File

@@ -7,7 +7,6 @@
initially written by Thomas Orgis
*/
#include "intsym.h"
#include "index.h"
#include "debug.h"

View File

@@ -774,7 +774,7 @@ int INT123_wrap_open(mpg123_handle *mh, void *handle, const char *path, int fd,
if(fd < 0)
{
if(!quiet)
error2("Cannot open file %s: %s", path, strerror(errno));
error2("Cannot open file %s: %s", path, INT123_strerror(errno));
return INT123_set_err(mh, MPG123_BAD_FILE);
}
}

View File

@@ -1,7 +1,7 @@
/*
mangle: support defines for preprocessed assembler
copyright 1995-2007 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright 1995-2023 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
This once started out as mangle.h from MPlayer, but you can't really call it derived work... the small part that in principle stems from MPlayer also being not very special (once you decided to use such a header at all, it's quite obvious material).
@@ -11,7 +11,6 @@
#define __MANGLE_H
#include "config.h"
#include "intsym.h"
#if (defined OPT_I486) || (defined OPT_I586) || (defined OPT_I586_DITHER) \
|| (defined OPT_MMX) || (defined OPT_SSE) || (defined OPT_3DNOW) || (defined OPT_3DNOWEXT) \

View File

@@ -14,7 +14,6 @@
#define MPG123_ENCODINGS 12
#include "config.h" /* Load this before _anything_ */
#include "intsym.h" /* Prefixing of internal symbols that still are public in a static lib. */
#include "abi_align.h"

View File

@@ -1,8 +1,8 @@
/*
hextxt: hex or printf text output (ASCII/UTF-8)
copyright 2017 by the mpg123 project
- free software under the terms of the LGPL 2.1
copyright 2017-2023 by the mpg123 project
free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Thomas Orgis
@@ -96,7 +96,7 @@ int hextxt_close(out123_handle *ao)
if(fp != stdout && INT123_compat_fclose(fp))
{
if(!AOQUIET)
error1("problem closing the output: %s\n", strerror(errno));
error1("problem closing the output: %s\n", INT123_strerror(errno));
return -1;
}
}
@@ -262,5 +262,5 @@ void hextxt_drain(out123_handle *ao)
if(!ao || !ao->userptr)
return;
if(fflush(ao->userptr) && !AOQUIET)
error1("flushing failed: %s\n", strerror(errno));
error1("flushing failed: %s\n", INT123_strerror(errno));
}

View File

@@ -1,7 +1,7 @@
/*
audio: audio output interface
copyright ?-2020 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright ?-2023 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Michael Hipp
*/
@@ -721,7 +721,7 @@ out123_play(out123_handle *ao, void *bytes, size_t count)
int block = count > (size_t)maxcount ? maxcount : (int)count;
written = ao->write(ao, bytes, block);
debug4( "written: %d errno: %i (%s), keep_on=%d"
, written, errno, strerror(errno)
, written, errno, INT123_strerror(errno)
, ao->flags & OUT123_KEEP_PLAYING );
if(written > 0)
{
@@ -742,7 +742,7 @@ out123_play(out123_handle *ao, void *bytes, size_t count)
ao->errcode = OUT123_DEV_PLAY;
if(!AOQUIET)
merror( "Error in writing audio, wrote only %d of %d (%s?)!"
, written, block, strerror(errno) );
, written, block, INT123_strerror(errno) );
/* This is a serious issue ending this playback round. */
break;
}

View File

@@ -1,7 +1,7 @@
/*
module.c: modular code loader
copyright 1995-2015 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright 1995-2023 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Nicholas J Humfrey
*/
@@ -10,7 +10,6 @@
#define _DEFAULT_SOURCE
#define _BSD_SOURCE
#include "config.h"
#include "intsym.h"
#include "stringlists.h"
#include "compat.h"
#include <errno.h>
@@ -109,7 +108,7 @@ mpg123_module_t* open_module_here( const char *dir, const char* type
if(!module_file)
{
if(verbose > -1)
error1( "Failed to allocate memory for module name: %s", strerror(errno) );
error1( "Failed to allocate memory for module name: %s", INT123_strerror(errno) );
return NULL;
}
snprintf(module_file, module_file_len, "%s_%s%s", type, name, LT_MODULE_EXT);
@@ -141,7 +140,7 @@ mpg123_module_t* open_module_here( const char *dir, const char* type
module_symbol = malloc(module_symbol_len);
if (module_symbol == NULL) {
if(verbose > -1)
error1( "Failed to allocate memory for module symbol: %s", strerror(errno) );
error1( "Failed to allocate memory for module symbol: %s", INT123_strerror(errno) );
return NULL;
}
snprintf( module_symbol, module_symbol_len, "%s%s%s", MODULE_SYMBOL_PREFIX, type, MODULE_SYMBOL_SUFFIX );
@@ -224,7 +223,7 @@ int INT123_list_modules( const char *type, char ***names, char ***descr, int ver
if (dir==NULL) {
if(verbose > -1)
error2("Failed to open the module directory (%s): %s\n"
, moddir, strerror(errno));
, moddir, INT123_strerror(errno));
free(moddir);
return -1;
}

View File

@@ -1,7 +1,7 @@
/*
out123_int: internal header for libout123
copyright ?-2021 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright ?-2023 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Michael Hipp (some traces left)
*/
@@ -12,7 +12,6 @@
#define MPG123_ENUM_API
#include "config.h"
#include "intsym.h"
#include "abi_align.h"
/* export DLL symbols */
#if defined(WIN32) && defined(DYNAMIC_BUILD)

View File

@@ -1,7 +1,7 @@
/*
wav.c: write wav/au/cdr files (and headerless raw
copyright ?-2015 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright ?-2023 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Samuel Audet
@@ -201,7 +201,7 @@ static int close_file(out123_handle *ao)
if(INT123_compat_fclose(wdat->wavfp))
{
if(!AOQUIET)
error1("problem closing the audio file, probably because of flushing to disk: %s\n", strerror(errno));
error1("problem closing the audio file, probably because of flushing to disk: %s\n", INT123_strerror(errno));
ret = -1;
}
}
@@ -230,7 +230,7 @@ static int write_header(out123_handle *ao)
)
{
if(!AOQUIET)
error1("cannot write header: %s", strerror(errno));
error1("cannot write header: %s", INT123_strerror(errno));
return -1;
}
else return 0;
@@ -596,7 +596,7 @@ int INT123_wav_write(out123_handle *ao, unsigned char *buf, int len)
if(fflush(wdat->wavfp))
{
if(!AOQUIET)
error1("flushing failed: %s\n", strerror(errno));
error1("flushing failed: %s\n", INT123_strerror(errno));
return -1;
}
#endif
@@ -619,7 +619,7 @@ int INT123_wav_close(out123_handle *ao)
if(fflush(wdat->wavfp))
{
if(!AOQUIET)
error1("cannot flush WAV stream: %s", strerror(errno));
error1("cannot flush WAV stream: %s", INT123_strerror(errno));
return close_file(ao);
}
if(fseek(wdat->wavfp, 0L, SEEK_SET) >= 0)
@@ -673,7 +673,7 @@ int INT123_au_close(out123_handle *ao)
if(fflush(wdat->wavfp))
{
if(!AOQUIET)
error1("cannot flush WAV stream: %s", strerror(errno));
error1("cannot flush WAV stream: %s", INT123_strerror(errno));
return close_file(ao);
}
if(fseek(wdat->wavfp, 0L, SEEK_SET) >= 0)
@@ -746,5 +746,5 @@ void INT123_wav_drain(out123_handle *ao)
return;
if(fflush(wdat->wavfp) && !AOQUIET)
error1("flushing failed: %s\n", strerror(errno));
error1("flushing failed: %s\n", INT123_strerror(errno));
}

View File

@@ -1,7 +1,7 @@
/*
xfermem: unidirectional fast pipe
copyright ?-2015 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright ?-2023 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Oliver Fromme
old timestamp: Sun Apr 6 02:26:26 MET DST 1997
@@ -222,7 +222,7 @@ int INT123_xfermem_putcmd (int fd, byte cmd)
if (errno != EINTR)
{
debug3("INT123_xfermem_putcmd(%i, %i) = -1 (%s)"
, fd, cmd, strerror(errno));
, fd, cmd, INT123_strerror(errno));
return (-1);
}
}

View File

@@ -1,7 +1,7 @@
/*
syn123_int: internal header for libsyn123
copyright 2018-2020 by the mpg123 project,
copyright 2018-2023 by the mpg123 project,
licensed under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
@@ -17,7 +17,6 @@
#ifdef LFS_LARGEFILE_64
#define _LARGEFILE64_SOURCE
#endif
#include "intsym.h"
#include "compat.h"
#include "abi_align.h"
/* export DLL symbols */

View File

@@ -1,7 +1,7 @@
/*
id3dump: Print ID3 tags of files, scanned using libmpg123.
copyright 2007-2021 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright 2007-2023 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Thomas Orgis
*/
@@ -352,7 +352,7 @@ static void store_pictures(const char* prefix, mpg123_id3v2 *v2)
}
else
{
error1("Unable to fdopen output: %s)", strerror(errno));
error1("Unable to fdopen output: %s)", INT123_strerror(errno));
++errors;
}
}

View File

@@ -1,7 +1,7 @@
/*
extract_frams: utlize the framebyframe API and mpg123_framedata to extract the MPEG frames out of a stream (strip off anything else).
copyright 2011-2013 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright 2011-2023 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Thomas Orgis
*/
@@ -155,7 +155,7 @@ int do_work(mpg123_handle *m)
if( 4 != INT123_unintr_write(STDOUT_FILENO, hbuf, 4) ||
bodybytes != INT123_unintr_write(STDOUT_FILENO, bodydata, bodybytes) )
{
fprintf(stderr, "Failed to write data: %s\n", strerror(errno));
fprintf(stderr, "Failed to write data: %s\n", INT123_strerror(errno));
return MPG123_ERR;
}
if(param.verbose)

View File

@@ -1,6 +1,11 @@
/*
net123_exec: network (HTTP(S)) streaming for mpg123 via fork+exec
copyright 2022-2023 by the mpg123 project
free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Thomas Orgis
This avoids linking any network code directly into mpg123, just using external
tools at runtime.
@@ -254,7 +259,7 @@ static void net123_close(net123_handle *nh)
kill(eh->worker, SIGKILL);
errno = 0;
if(waitpid(eh->worker, NULL, 0) < 0)
merror("failed to wait for worker process: %s", strerror(errno));
merror("failed to wait for worker process: %s", INT123_strerror(errno));
else if(param.verbose > 1)
fprintf(stderr, "Note: network helper %"PRIiMAX" finished\n", (intmax_t)eh->worker);
}
@@ -320,7 +325,7 @@ net123_handle *net123_open_exec(const char *url, const char * const * client_hea
errno = 0;
if(pipe(fd))
{
merror("failed creating a pipe: %s", strerror(errno));
merror("failed creating a pipe: %s", INT123_strerror(errno));
free(nh);
return NULL;
}
@@ -331,7 +336,7 @@ net123_handle *net123_open_exec(const char *url, const char * const * client_hea
eh->worker = fork();
if(eh->worker == -1)
{
merror("fork failed: %s", strerror(errno));
merror("fork failed: %s", INT123_strerror(errno));
free(nh);
return NULL;
}
@@ -367,7 +372,7 @@ net123_handle *net123_open_exec(const char *url, const char * const * client_hea
dup2(errfd, STDERR_FILENO);
}
execvp(argv[0], argv);
merror("cannot execute %s: %s", argv[0], strerror(errno));
merror("cannot execute %s: %s", argv[0], INT123_strerror(errno));
exit(1);
}
// parent

View File

@@ -1,7 +1,7 @@
/*
out123: stream data from libmpg123 or libsyn123 to an audio output device
copyright 1995-2021 by the mpg123 project,
copyright 1995-2023 by the mpg123 project,
free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
@@ -1079,7 +1079,7 @@ void push_output(unsigned char *buf, size_t samples)
if(also_stdout && INT123_unintr_fwrite(buf, pcmframe, samples, stdout) < samples)
{
if(!quiet)
error1( "failed to copy stream to stdout: %s", strerror(errno));
error1( "failed to copy stream to stdout: %s", INT123_strerror(errno));
safe_exit(133);
}
}
@@ -1114,7 +1114,7 @@ FILE* open_next_file(int argc, char** argv, int firstrun)
in = strcmp(filename, "-") ? INT123_compat_fopen(filename, "rb") : stdin;
if(!in)
merror( "Failed to open input file '%s' (%s), ignoring."
, filename, strerror(errno) );
, filename, INT123_strerror(errno) );
else
had_something = 1;
}

View File

@@ -2,7 +2,7 @@
resolver.c: TCP network stuff, for IPv4 and IPv6
Oh, and also some URL parsing... extracting host name and such.
copyright 2008-2010 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright 2008-2023 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written Thomas Orgis (based on httpget.c)
@@ -222,13 +222,13 @@ static int timeout_connect(int sockfd, const struct sockaddr *serv_addr, socklen
}
else
{
error1("error from select(): %s", strerror(errno));
error1("error from select(): %s", INT123_strerror(errno));
return -1;
}
}
else
{
error1("connection failed: %s", strerror(errno));
error1("connection failed: %s", INT123_strerror(errno));
return err;
}
}
@@ -236,7 +236,7 @@ static int timeout_connect(int sockfd, const struct sockaddr *serv_addr, socklen
{
if(connect(sockfd, serv_addr, addrlen))
{
error1("connection failed: %s", strerror(errno));
error1("connection failed: %s", INT123_strerror(errno));
return -1;
}
else return 0; /* _good_ */
@@ -284,7 +284,7 @@ int open_connection(mpg123_string *host, mpg123_string *port)
if((sock = socket(PF_INET, SOCK_STREAM, 6)) < 0)
{
error1("Cannot create socket: %s", strerror(errno));
error1("Cannot create socket: %s", INT123_strerror(errno));
return -1;
}
if(timeout_connect(sock, (struct sockaddr *)&server, sizeof(server)))

View File

@@ -4,7 +4,7 @@
This evolved into the generic I/O interposer for direct file or http stream
access, with explicit buffering for getline.
copyright 2010-2022 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright 2010-2023 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Michael Hipp
*/
@@ -597,7 +597,7 @@ struct stream *stream_open(const char *url)
sd->fd = INT123_compat_open(url, O_RDONLY|O_BINARY);
if(sd->fd < 0)
{
merror("failed to open file: %s: %s", url, strerror(errno));
merror("failed to open file: %s: %s", url, INT123_strerror(errno));
stream_close(sd);
return NULL;
}
@@ -662,7 +662,7 @@ int dump_setup(struct stream *sd, mpg123_handle *mh)
}
if(dump_fd < 0)
{
error1("Failed to open dump file: %s\n", strerror(errno));
error1("Failed to open dump file: %s\n", INT123_strerror(errno));
return -1;
}
#ifdef WIN32

View File

@@ -88,7 +88,7 @@ int term_init(void)
if(term_setup() < 0)
{
if(errno)
merror("failed to set up terminal: %s", strerror(errno));
merror("failed to set up terminal: %s", INT123_strerror(errno));
else
error("failed to set up terminal");
return -1;

View File

@@ -3,7 +3,7 @@
HAVE_TERMIOS is a prerequisite.
copyright 2008-2022 by the mpg123 project - free software under the terms of the LGPL 2.1
copyright 2008-2023 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Thomas Orgis
*/
@@ -149,7 +149,7 @@ int term_setup(void)
term_fd = open(term_name, O_RDONLY);
if(term_fd < 0)
{
merror("failed to open terminal: %s", strerror(errno));
merror("failed to open terminal: %s", INT123_strerror(errno));
return -1;
}
}
@@ -159,7 +159,7 @@ int term_setup(void)
// For now, this always fails on OS/2, but they might fix things.
// So just try to move on.
#ifndef __OS2__
merror("failed to get terminal attributes: %s", strerror(errno));
merror("failed to get terminal attributes: %s", INT123_strerror(errno));
return -1;
#endif
}
@@ -170,7 +170,7 @@ int term_setup(void)
close(term_fd);
term_fd = -1;
if(errno)
merror("failure setting terminal attributes: %s", strerror(errno));
merror("failure setting terminal attributes: %s", INT123_strerror(errno));
else
error("failure setting terminal attributes");
return -1;

View File

@@ -1,3 +1,11 @@
/*
win32_net: Windows-specific network code
copyright 2009-2023 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Jonathan Yong (extracting out of httpget.c)
*/
#include "win32_support.h"
#include "mpg123app.h"
#include "debug.h"
@@ -170,7 +178,7 @@ static int win32_net_timeout_connect(int sockfd, const struct sockaddr *serv_add
}
else
{
/*error1("error from select(): %s", strerror(errno));*/
/*error1("error from select(): %s", INT123_strerror(errno));*/
debug("error from select():");
msgme1;
return -1;
@@ -178,7 +186,7 @@ static int win32_net_timeout_connect(int sockfd, const struct sockaddr *serv_add
}
else
{
/*error1("connection failed: %s", strerror(errno));*/
/*error1("connection failed: %s", INT123_strerror(errno));*/
debug("connection failed: ");
msgme1;
return err;
@@ -188,7 +196,7 @@ static int win32_net_timeout_connect(int sockfd, const struct sockaddr *serv_add
{
if(connect(ws.local_socket, serv_addr, addrlen) == SOCKET_ERROR)
{
/*error1("connection failed: %s", strerror(errno));*/
/*error1("connection failed: %s", INT123_strerror(errno));*/
debug("connection failed");
msgme1;
return -1;