summaryrefslogtreecommitdiffstats
path: root/src/modules
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2006-05-22 15:20:46 +0000
committerPierre Ossman <ossman@cendio.se>2006-05-22 15:20:46 +0000
commit4e3dc7ce68561c16254712d713b2ccd472b8afe7 (patch)
tree2b0494e14605f3f3e133765126eaee3c77c8b482 /src/modules
parentbf09399d0e84c43fbae3d24b5c71dc8d85b62fe7 (diff)
Wrap strerror() in a function that makes it thread safe and converts the
output to UTF-8. git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@945 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/module-alsa-source.c3
-rw-r--r--src/modules/module-detect.c7
-rw-r--r--src/modules/module-esound-compat-spawnfd.c4
-rw-r--r--src/modules/module-esound-compat-spawnpid.c4
-rw-r--r--src/modules/module-esound-sink.c11
-rw-r--r--src/modules/module-jack-sink.c3
-rw-r--r--src/modules/module-jack-source.c3
-rw-r--r--src/modules/module-match.c3
-rw-r--r--src/modules/module-mmkbd-evdev.c13
-rw-r--r--src/modules/module-oss-mmap.c29
-rw-r--r--src/modules/module-oss.c17
-rw-r--r--src/modules/module-pipe-sink.c7
-rw-r--r--src/modules/module-pipe-source.c7
-rw-r--r--src/modules/module-protocol-stub.c5
-rw-r--r--src/modules/module-solaris.c15
-rw-r--r--src/modules/module-volume-restore.c5
-rw-r--r--src/modules/oss-util.c20
-rw-r--r--src/modules/rtp/module-rtp-recv.c9
-rw-r--r--src/modules/rtp/module-rtp-send.c11
-rw-r--r--src/modules/rtp/rtp.c8
-rw-r--r--src/modules/rtp/sap.c9
21 files changed, 109 insertions, 84 deletions
diff --git a/src/modules/module-alsa-source.c b/src/modules/module-alsa-source.c
index 654f3e49..c72b0322 100644
--- a/src/modules/module-alsa-source.c
+++ b/src/modules/module-alsa-source.c
@@ -34,6 +34,7 @@
#include <asoundlib.h>
+#include <polyp/error.h>
#include <polyp/xmalloc.h>
#include <polypcore/core.h>
@@ -134,7 +135,7 @@ static void do_read(struct userdata *u) {
continue;
}
- pa_log(__FILE__": snd_pcm_readi() failed: %s", strerror(-frames));
+ pa_log(__FILE__": snd_pcm_readi() failed: %s", pa_cstrerror(-frames));
return;
}
diff --git a/src/modules/module-detect.c b/src/modules/module-detect.c
index 2edbea5e..e4f2e3f9 100644
--- a/src/modules/module-detect.c
+++ b/src/modules/module-detect.c
@@ -33,6 +33,7 @@
#include <sys/types.h>
#include <sys/stat.h>
+#include <polyp/error.h>
#include <polyp/xmalloc.h>
#include <polypcore/module.h>
@@ -56,7 +57,7 @@ static int detect_alsa(pa_core *c, int just_one) {
if (!(f = fopen("/proc/asound/devices", "r"))) {
if (errno != ENOENT)
- pa_log_error(__FILE__": open(\"/proc/asound/devices\") failed: %s", strerror(errno));
+ pa_log_error(__FILE__": open(\"/proc/asound/devices\") failed: %s", pa_cstrerror(errno));
return -1;
}
@@ -119,7 +120,7 @@ static int detect_oss(pa_core *c, int just_one) {
!(f = fopen("/proc/asound/oss/sndstat", "r"))) {
if (errno != ENOENT)
- pa_log_error(__FILE__": failed to open OSS sndstat device: %s", strerror(errno));
+ pa_log_error(__FILE__": failed to open OSS sndstat device: %s", pa_cstrerror(errno));
return -1;
}
@@ -175,7 +176,7 @@ static int detect_solaris(pa_core *c, int just_one) {
if (stat(dev, &s) < 0) {
if (errno != ENOENT)
- pa_log_error(__FILE__": failed to open device %s: %s", dev, strerror(errno));
+ pa_log_error(__FILE__": failed to open device %s: %s", dev, pa_cstrerror(errno));
return -1;
}
diff --git a/src/modules/module-esound-compat-spawnfd.c b/src/modules/module-esound-compat-spawnfd.c
index bf89ca70..f59e9e21 100644
--- a/src/modules/module-esound-compat-spawnfd.c
+++ b/src/modules/module-esound-compat-spawnfd.c
@@ -28,6 +28,8 @@
#include <string.h>
#include <errno.h>
+#include <polyp/error.h>
+
#include <polypcore/module.h>
#include <polypcore/modargs.h>
#include <polypcore/core-util.h>
@@ -59,7 +61,7 @@ int pa__init(pa_core *c, pa_module*m) {
}
if (pa_loop_write(fd, &x, sizeof(x)) != sizeof(x))
- pa_log(__FILE__": WARNING: write(%u, 1, 1) failed: %s", fd, strerror(errno));
+ pa_log(__FILE__": WARNING: write(%u, 1, 1) failed: %s", fd, pa_cstrerror(errno));
close(fd);
diff --git a/src/modules/module-esound-compat-spawnpid.c b/src/modules/module-esound-compat-spawnpid.c
index 895abec3..c14ce12a 100644
--- a/src/modules/module-esound-compat-spawnpid.c
+++ b/src/modules/module-esound-compat-spawnpid.c
@@ -28,6 +28,8 @@
#include <errno.h>
#include <signal.h>
+#include <polyp/error.h>
+
#include <polypcore/module.h>
#include <polypcore/core-util.h>
#include <polypcore/modargs.h>
@@ -59,7 +61,7 @@ int pa__init(pa_core *c, pa_module*m) {
}
if (kill(pid, SIGUSR1) < 0)
- pa_log(__FILE__": WARNING: kill(%u) failed: %s", pid, strerror(errno));
+ pa_log(__FILE__": WARNING: kill(%u) failed: %s", pid, pa_cstrerror(errno));
pa_module_unload_request(m);
diff --git a/src/modules/module-esound-sink.c b/src/modules/module-esound-sink.c
index cf3ce807..72298679 100644
--- a/src/modules/module-esound-sink.c
+++ b/src/modules/module-esound-sink.c
@@ -33,6 +33,7 @@
#include <unistd.h>
#include <limits.h>
+#include <polyp/error.h>
#include <polyp/xmalloc.h>
#include <polypcore/iochannel.h>
@@ -128,7 +129,7 @@ static int do_write(struct userdata *u) {
assert(u->write_index < u->write_length);
if ((r = pa_iochannel_write(u->io, (uint8_t*) u->write_data + u->write_index, u->write_length - u->write_index)) <= 0) {
- pa_log(__FILE__": write() failed: %s", strerror(errno));
+ pa_log(__FILE__": write() failed: %s", pa_cstrerror(errno));
return -1;
}
@@ -150,7 +151,7 @@ static int do_write(struct userdata *u) {
assert(u->memchunk.memblock && u->memchunk.length);
if ((r = pa_iochannel_write(u->io, (uint8_t*) u->memchunk.memblock->data + u->memchunk.index, u->memchunk.length)) < 0) {
- pa_log(__FILE__": write() failed: %s", strerror(errno));
+ pa_log(__FILE__": write() failed: %s", pa_cstrerror(errno));
return -1;
}
@@ -175,7 +176,7 @@ static int handle_response(struct userdata *u) {
/* Process auth data */
if (!*(int32_t*) u->read_data) {
- pa_log(__FILE__": Authentication failed: %s", strerror(errno));
+ pa_log(__FILE__": Authentication failed: %s", pa_cstrerror(errno));
return -1;
}
@@ -245,7 +246,7 @@ static int do_read(struct userdata *u) {
assert(u->read_index < u->read_length);
if ((r = pa_iochannel_read(u->io, (uint8_t*) u->read_data + u->read_index, u->read_length - u->read_index)) <= 0) {
- pa_log(__FILE__": read() failed: %s", r < 0 ? strerror(errno) : "EOF");
+ pa_log(__FILE__": read() failed: %s", r < 0 ? pa_cstrerror(errno) : "EOF");
cancel(u);
return -1;
}
@@ -305,7 +306,7 @@ static void on_connection(PA_GCC_UNUSED pa_socket_client *c, pa_iochannel*io, vo
u->client = NULL;
if (!io) {
- pa_log(__FILE__": connection failed: %s", strerror(errno));
+ pa_log(__FILE__": connection failed: %s", pa_cstrerror(errno));
cancel(u);
return;
}
diff --git a/src/modules/module-jack-sink.c b/src/modules/module-jack-sink.c
index 96db837a..db2ba030 100644
--- a/src/modules/module-jack-sink.c
+++ b/src/modules/module-jack-sink.c
@@ -36,6 +36,7 @@
#include <jack/jack.h>
+#include <polyp/error.h>
#include <polyp/xmalloc.h>
#include <polypcore/iochannel.h>
@@ -272,7 +273,7 @@ int pa__init(pa_core *c, pa_module*m) {
pthread_cond_init(&u->cond, NULL);
if (pipe(u->pipe_fds) < 0) {
- pa_log(__FILE__": pipe() failed: %s", strerror(errno));
+ pa_log(__FILE__": pipe() failed: %s", pa_cstrerror(errno));
goto fail;
}
diff --git a/src/modules/module-jack-source.c b/src/modules/module-jack-source.c
index 3d783145..8816fb8a 100644
--- a/src/modules/module-jack-source.c
+++ b/src/modules/module-jack-source.c
@@ -36,6 +36,7 @@
#include <jack/jack.h>
+#include <polyp/error.h>
#include <polyp/xmalloc.h>
#include <polypcore/iochannel.h>
@@ -270,7 +271,7 @@ int pa__init(pa_core *c, pa_module*m) {
pthread_cond_init(&u->cond, NULL);
if (pipe(u->pipe_fds) < 0) {
- pa_log(__FILE__": pipe() failed: %s", strerror(errno));
+ pa_log(__FILE__": pipe() failed: %s", pa_cstrerror(errno));
goto fail;
}
diff --git a/src/modules/module-match.c b/src/modules/module-match.c
index c7ca12a5..f68f0c61 100644
--- a/src/modules/module-match.c
+++ b/src/modules/module-match.c
@@ -32,6 +32,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <polyp/error.h>
#include <polyp/xmalloc.h>
#include <polypcore/module.h>
@@ -86,7 +87,7 @@ static int load_rules(struct userdata *u, const char *filename) {
pa_open_config_file(DEFAULT_MATCH_TABLE_FILE, DEFAULT_MATCH_TABLE_FILE_USER, NULL, &fn, "r");
if (!f) {
- pa_log(__FILE__": failed to open file '%s': %s", fn, strerror(errno));
+ pa_log(__FILE__": failed to open file '%s': %s", fn, pa_cstrerror(errno));
goto finish;
}
diff --git a/src/modules/module-mmkbd-evdev.c b/src/modules/module-mmkbd-evdev.c
index 55f0b2c8..d6c91e2e 100644
--- a/src/modules/module-mmkbd-evdev.c
+++ b/src/modules/module-mmkbd-evdev.c
@@ -33,6 +33,7 @@
#include <linux/input.h>
+#include <polyp/error.h>
#include <polyp/xmalloc.h>
#include <polypcore/module.h>
@@ -89,7 +90,7 @@ static void io_callback(pa_mainloop_api *io, PA_GCC_UNUSED pa_io_event *e, PA_GC
struct input_event ev;
if (pa_loop_read(u->fd, &ev, sizeof(ev)) <= 0) {
- pa_log(__FILE__": failed to read from event device: %s", strerror(errno));
+ pa_log(__FILE__": failed to read from event device: %s", pa_cstrerror(errno));
goto fail;
}
@@ -183,19 +184,19 @@ int pa__init(pa_core *c, pa_module*m) {
u->fd = -1;
if ((u->fd = open(pa_modargs_get_value(ma, "device", DEFAULT_DEVICE), O_RDONLY)) < 0) {
- pa_log(__FILE__": failed to open evdev device: %s", strerror(errno));
+ pa_log(__FILE__": failed to open evdev device: %s", pa_cstrerror(errno));
goto fail;
}
if (ioctl(u->fd, EVIOCGVERSION, &version) < 0) {
- pa_log(__FILE__": EVIOCGVERSION failed: %s", strerror(errno));
+ pa_log(__FILE__": EVIOCGVERSION failed: %s", pa_cstrerror(errno));
goto fail;
}
pa_log_info(__FILE__": evdev driver version %i.%i.%i", version >> 16, (version >> 8) & 0xff, version & 0xff);
if(ioctl(u->fd, EVIOCGID, &input_id)) {
- pa_log(__FILE__": EVIOCGID failed: %s", strerror(errno));
+ pa_log(__FILE__": EVIOCGID failed: %s", pa_cstrerror(errno));
goto fail;
}
@@ -204,7 +205,7 @@ int pa__init(pa_core *c, pa_module*m) {
memset(name, 0, sizeof(name));
if(ioctl(u->fd, EVIOCGNAME(sizeof(name)), name) < 0) {
- pa_log(__FILE__": EVIOCGNAME failed: %s", strerror(errno));
+ pa_log(__FILE__": EVIOCGNAME failed: %s", pa_cstrerror(errno));
goto fail;
}
@@ -212,7 +213,7 @@ int pa__init(pa_core *c, pa_module*m) {
memset(evtype_bitmask, 0, sizeof(evtype_bitmask));
if (ioctl(u->fd, EVIOCGBIT(0, EV_MAX), evtype_bitmask) < 0) {
- pa_log(__FILE__": EVIOCGBIT failed: %s", strerror(errno));
+ pa_log(__FILE__": EVIOCGBIT failed: %s", pa_cstrerror(errno));
goto fail;
}
diff --git a/src/modules/module-oss-mmap.c b/src/modules/module-oss-mmap.c
index a1b40389..dac7d7f3 100644
--- a/src/modules/module-oss-mmap.c
+++ b/src/modules/module-oss-mmap.c
@@ -36,6 +36,7 @@
#include <limits.h>
#include <sys/mman.h>
+#include <polyp/error.h>
#include <polyp/xmalloc.h>
#include <polypcore/iochannel.h>
@@ -152,7 +153,7 @@ static void do_write(struct userdata *u) {
update_usage(u);
if (ioctl(u->fd, SNDCTL_DSP_GETOPTR, &info) < 0) {
- pa_log(__FILE__": SNDCTL_DSP_GETOPTR: %s", strerror(errno));
+ pa_log(__FILE__": SNDCTL_DSP_GETOPTR: %s", pa_cstrerror(errno));
return;
}
@@ -215,7 +216,7 @@ static void do_read(struct userdata *u) {
update_usage(u);
if (ioctl(u->fd, SNDCTL_DSP_GETIPTR, &info) < 0) {
- pa_log(__FILE__": SNDCTL_DSP_GETIPTR: %s", strerror(errno));
+ pa_log(__FILE__": SNDCTL_DSP_GETIPTR: %s", pa_cstrerror(errno));
return;
}
@@ -246,7 +247,7 @@ static pa_usec_t sink_get_latency_cb(pa_sink *s) {
assert(s && u);
if (ioctl(u->fd, SNDCTL_DSP_GETOPTR, &info) < 0) {
- pa_log(__FILE__": SNDCTL_DSP_GETOPTR: %s", strerror(errno));
+ pa_log(__FILE__": SNDCTL_DSP_GETOPTR: %s", pa_cstrerror(errno));
return 0;
}
@@ -272,7 +273,7 @@ static pa_usec_t source_get_latency_cb(pa_source *s) {
assert(s && u);
if (ioctl(u->fd, SNDCTL_DSP_GETIPTR, &info) < 0) {
- pa_log(__FILE__": SNDCTL_DSP_GETIPTR: %s", strerror(errno));
+ pa_log(__FILE__": SNDCTL_DSP_GETIPTR: %s", pa_cstrerror(errno));
return 0;
}
@@ -295,7 +296,7 @@ static int sink_get_hw_volume(pa_sink *s) {
struct userdata *u = s->userdata;
if (pa_oss_get_pcm_volume(u->fd, &s->sample_spec, &s->hw_volume) < 0) {
- pa_log_info(__FILE__": device doesn't support reading mixer settings: %s", strerror(errno));
+ pa_log_info(__FILE__": device doesn't support reading mixer settings: %s", pa_cstrerror(errno));
s->get_hw_volume = NULL;
return -1;
}
@@ -307,7 +308,7 @@ static int sink_set_hw_volume(pa_sink *s) {
struct userdata *u = s->userdata;
if (pa_oss_set_pcm_volume(u->fd, &s->sample_spec, &s->hw_volume) < 0) {
- pa_log_info(__FILE__": device doesn't support writing mixer settings: %s", strerror(errno));
+ pa_log_info(__FILE__": device doesn't support writing mixer settings: %s", pa_cstrerror(errno));
s->set_hw_volume = NULL;
return -1;
}
@@ -319,7 +320,7 @@ static int source_get_hw_volume(pa_source *s) {
struct userdata *u = s->userdata;
if (pa_oss_get_input_volume(u->fd, &s->sample_spec, &s->hw_volume) < 0) {
- pa_log_info(__FILE__": device doesn't support reading mixer settings: %s", strerror(errno));
+ pa_log_info(__FILE__": device doesn't support reading mixer settings: %s", pa_cstrerror(errno));
s->get_hw_volume = NULL;
return -1;
}
@@ -331,7 +332,7 @@ static int source_set_hw_volume(pa_source *s) {
struct userdata *u = s->userdata;
if (pa_oss_set_input_volume(u->fd, &s->sample_spec, &s->hw_volume) < 0) {
- pa_log_info(__FILE__": device doesn't support writing mixer settings: %s", strerror(errno));
+ pa_log_info(__FILE__": device doesn't support writing mixer settings: %s", pa_cstrerror(errno));
s->set_hw_volume = NULL;
return -1;
}
@@ -413,7 +414,7 @@ int pa__init(pa_core *c, pa_module*m) {
if (mode != O_WRONLY) {
if (ioctl(u->fd, SNDCTL_DSP_GETISPACE, &info) < 0) {
- pa_log(__FILE__": SNDCTL_DSP_GETISPACE: %s", strerror(errno));
+ pa_log(__FILE__": SNDCTL_DSP_GETISPACE: %s", pa_cstrerror(errno));
goto fail;
}
@@ -425,7 +426,7 @@ int pa__init(pa_core *c, pa_module*m) {
pa_log(__FILE__": mmap failed for input. Changing to O_WRONLY mode.");
mode = O_WRONLY;
} else {
- pa_log(__FILE__": mmap(): %s", strerror(errno));
+ pa_log(__FILE__": mmap(): %s", pa_cstrerror(errno));
goto fail;
}
} else {
@@ -452,7 +453,7 @@ int pa__init(pa_core *c, pa_module*m) {
if (mode != O_RDONLY) {
if (ioctl(u->fd, SNDCTL_DSP_GETOSPACE, &info) < 0) {
- pa_log(__FILE__": SNDCTL_DSP_GETOSPACE: %s", strerror(errno));
+ pa_log(__FILE__": SNDCTL_DSP_GETOSPACE: %s", pa_cstrerror(errno));
goto fail;
}
@@ -464,7 +465,7 @@ int pa__init(pa_core *c, pa_module*m) {
pa_log(__FILE__": mmap filed for output. Changing to O_RDONLY mode.");
mode = O_RDONLY;
} else {
- pa_log(__FILE__": mmap(): %s", strerror(errno));
+ pa_log(__FILE__": mmap(): %s", pa_cstrerror(errno));
goto fail;
}
} else {
@@ -492,12 +493,12 @@ int pa__init(pa_core *c, pa_module*m) {
zero = 0;
if (ioctl(u->fd, SNDCTL_DSP_SETTRIGGER, &zero) < 0) {
- pa_log(__FILE__": SNDCTL_DSP_SETTRIGGER: %s", strerror(errno));
+ pa_log(__FILE__": SNDCTL_DSP_SETTRIGGER: %s", pa_cstrerror(errno));
goto fail;
}
if (ioctl(u->fd, SNDCTL_DSP_SETTRIGGER, &enable_bits) < 0) {
- pa_log(__FILE__": SNDCTL_DSP_SETTRIGGER: %s", strerror(errno));
+ pa_log(__FILE__": SNDCTL_DSP_SETTRIGGER: %s", pa_cstrerror(errno));
goto fail;
}
diff --git a/src/modules/module-oss.c b/src/modules/module-oss.c
index 9233420d..8e217855 100644
--- a/src/modules/module-oss.c
+++ b/src/modules/module-oss.c
@@ -35,6 +35,7 @@
#include <unistd.h>
#include <limits.h>
+#include <polyp/error.h>
#include <polyp/xmalloc.h>
#include <polypcore/iochannel.h>
@@ -146,7 +147,7 @@ static void do_write(struct userdata *u) {
assert(memchunk->length);
if ((r = pa_iochannel_write(u->io, (uint8_t*) memchunk->memblock->data + memchunk->index, memchunk->length)) < 0) {
- pa_log(__FILE__": write() failed: %s", strerror(errno));
+ pa_log(__FILE__": write() failed: %s", pa_cstrerror(errno));
break;
}
@@ -199,7 +200,7 @@ static void do_read(struct userdata *u) {
if ((r = pa_iochannel_read(u->io, memchunk.memblock->data, memchunk.memblock->length)) < 0) {
pa_memblock_unref(memchunk.memblock);
if (errno != EAGAIN)
- pa_log(__FILE__": read() failed: %s", strerror(errno));
+ pa_log(__FILE__": read() failed: %s", pa_cstrerror(errno));
break;
}
@@ -234,7 +235,7 @@ static pa_usec_t sink_get_latency_cb(pa_sink *s) {
assert(s && u && u->sink);
if (ioctl(u->fd, SNDCTL_DSP_GETODELAY, &arg) < 0) {
- pa_log_info(__FILE__": device doesn't support SNDCTL_DSP_GETODELAY: %s", strerror(errno));
+ pa_log_info(__FILE__": device doesn't support SNDCTL_DSP_GETODELAY: %s", pa_cstrerror(errno));
s->get_latency = NULL;
return 0;
}
@@ -270,7 +271,7 @@ static int sink_get_hw_volume(pa_sink *s) {
struct userdata *u = s->userdata;
if (pa_oss_get_pcm_volume(u->fd, &s->sample_spec, &s->hw_volume) < 0) {
- pa_log_info(__FILE__": device doesn't support reading mixer settings: %s", strerror(errno));
+ pa_log_info(__FILE__": device doesn't support reading mixer settings: %s", pa_cstrerror(errno));
s->get_hw_volume = NULL;
return -1;
}
@@ -282,7 +283,7 @@ static int sink_set_hw_volume(pa_sink *s) {
struct userdata *u = s->userdata;
if (pa_oss_set_pcm_volume(u->fd, &s->sample_spec, &s->hw_volume) < 0) {
- pa_log_info(__FILE__": device doesn't support writing mixer settings: %s", strerror(errno));
+ pa_log_info(__FILE__": device doesn't support writing mixer settings: %s", pa_cstrerror(errno));
s->set_hw_volume = NULL;
return -1;
}
@@ -294,7 +295,7 @@ static int source_get_hw_volume(pa_source *s) {
struct userdata *u = s->userdata;
if (pa_oss_get_input_volume(u->fd, &s->sample_spec, &s->hw_volume) < 0) {
- pa_log_info(__FILE__": device doesn't support reading mixer settings: %s", strerror(errno));
+ pa_log_info(__FILE__": device doesn't support reading mixer settings: %s", pa_cstrerror(errno));
s->get_hw_volume = NULL;
return -1;
}
@@ -306,7 +307,7 @@ static int source_set_hw_volume(pa_source *s) {
struct userdata *u = s->userdata;
if (pa_oss_set_input_volume(u->fd, &s->sample_spec, &s->hw_volume) < 0) {
- pa_log_info(__FILE__": device doesn't support writing mixer settings: %s", strerror(errno));
+ pa_log_info(__FILE__": device doesn't support writing mixer settings: %s", pa_cstrerror(errno));
s->set_hw_volume = NULL;
return -1;
}
@@ -380,7 +381,7 @@ int pa__init(pa_core *c, pa_module*m) {
goto fail;
if (ioctl(fd, SNDCTL_DSP_GETBLKSIZE, &frag_size) < 0) {
- pa_log(__FILE__": SNDCTL_DSP_GETBLKSIZE: %s", strerror(errno));
+ pa_log(__FILE__": SNDCTL_DSP_GETBLKSIZE: %s", pa_cstrerror(errno));
goto fail;
}
assert(frag_size);
diff --git a/src/modules/module-pipe-sink.c b/src/modules/module-pipe-sink.c
index 6492ba6a..f0569ce9 100644
--- a/src/modules/module-pipe-sink.c
+++ b/src/modules/module-pipe-sink.c
@@ -33,6 +33,7 @@
#include <unistd.h>
#include <limits.h>
+#include <polyp/error.h>
#include <polyp/xmalloc.h>
#include <polypcore/iochannel.h>
@@ -99,7 +100,7 @@ static void do_write(struct userdata *u) {
assert(u->memchunk.memblock && u->memchunk.length);
if ((r = pa_iochannel_write(u->io, (uint8_t*) u->memchunk.memblock->data + u->memchunk.index, u->memchunk.length)) < 0) {
- pa_log(__FILE__": write() failed: %s", strerror(errno));
+ pa_log(__FILE__": write(): %s", pa_cstrerror(errno));
return;
}
@@ -163,14 +164,14 @@ int pa__init(pa_core *c, pa_module*m) {
mkfifo(p = pa_modargs_get_value(ma, "file", DEFAULT_FIFO_NAME), 0777);
if ((fd = open(p, O_RDWR)) < 0) {
- pa_log(__FILE__": open('%s'): %s", p, strerror(errno));
+ pa_log(__FILE__": open('%s'): %s", p, pa_cstrerror(errno));
goto fail;
}
pa_fd_set_cloexec(fd, 1);
if (fstat(fd, &st) < 0) {
- pa_log(__FILE__": fstat('%s'): %s", p, strerror(errno));
+ pa_log(__FILE__": fstat('%s'): %s", p, pa_cstrerror(errno));
goto fail;
}
diff --git a/src/modules/module-pipe-source.c b/src/modules/module-pipe-source.c
index 9f755440..77212ce5 100644
--- a/src/modules/module-pipe-source.c
+++ b/src/modules/module-pipe-source.c
@@ -33,6 +33,7 @@
#include <unistd.h>
#include <limits.h>
+#include <polyp/error.h>
#include <polyp/xmalloc.h>
#include <polypcore/iochannel.h>
@@ -96,7 +97,7 @@ static void do_read(struct userdata *u) {
assert(u->chunk.memblock && u->chunk.memblock->length > u->chunk.index);
if ((r = pa_iochannel_read(u->io, (uint8_t*) u->chunk.memblock->data + u->chunk.index, u->chunk.memblock->length - u->chunk.index)) <= 0) {
- pa_log(__FILE__": read() failed: %s", strerror(errno));
+ pa_log(__FILE__": read(): %s", pa_cstrerror(errno));
return;
}
@@ -141,14 +142,14 @@ int pa__init(pa_core *c, pa_module*m) {
mkfifo(p = pa_modargs_get_value(ma, "file", DEFAULT_FIFO_NAME), 0777);
if ((fd = open(p, O_RDWR)) < 0) {
- pa_log(__FILE__": open('%s'): %s", p, strerror(errno));
+ pa_log(__FILE__": open('%s'): %s", p, pa_cstrerror(errno));
goto fail;
}
pa_fd_set_cloexec(fd, 1);
if (fstat(fd, &st) < 0) {
- pa_log(__FILE__": fstat('%s'): %s", p, strerror(errno));
+ pa_log(__FILE__": fstat('%s'): %s", p, pa_cstrerror(errno));
goto fail;
}
diff --git a/src/modules/module-protocol-stub.c b/src/modules/module-protocol-stub.c
index cfe661a3..8eba352b 100644
--- a/src/modules/module-protocol-stub.c
+++ b/src/modules/module-protocol-stub.c
@@ -42,6 +42,7 @@
#include "../polypcore/winsock.h"
+#include <polyp/error.h>
#include <polyp/xmalloc.h>
#include <polypcore/module.h>
@@ -250,7 +251,7 @@ int pa__init(pa_core *c, pa_module*m) {
}
if ((r = pa_unix_socket_remove_stale(tmp)) < 0) {
- pa_log(__FILE__": Failed to remove stale UNIX socket '%s': %s", tmp, strerror(errno));
+ pa_log(__FILE__": Failed to remove stale UNIX socket '%s': %s", tmp, pa_cstrerror(errno));
goto fail;
}
@@ -328,7 +329,7 @@ void pa__done(pa_core *c, pa_module*m) {
if ((p = pa_parent_dir(u->socket_path))) {
if (rmdir(p) < 0 && errno != ENOENT && errno != ENOTEMPTY)
- pa_log(__FILE__": Failed to remove %s: %s.", u->socket_path, strerror(errno));
+ pa_log(__FILE__": Failed to remove %s: %s.", u->socket_path, pa_cstrerror(errno));
pa_xfree(p);
}
diff --git a/src/modules/module-solaris.c b/src/modules/module-solaris.c
index 77eb4e49..8670bb35 100644
--- a/src/modules/module-solaris.c
+++ b/src/modules/module-solaris.c
@@ -40,6 +40,7 @@
#include <sys/conf.h>
#include <sys/audio.h>
+#include <polyp/error.h>
#include <polyp/mainloop-signal.h>
#include <polyp/xmalloc.h>
@@ -168,7 +169,7 @@ static void do_write(struct userdata *u) {
}
if ((r = pa_iochannel_write(u->io, (uint8_t*) memchunk->memblock->data + memchunk->index, len)) < 0) {
- pa_log(__FILE__": write() failed: %s", strerror(errno));
+ pa_log(__FILE__": write() failed: %s", pa_cstrerror(errno));
return;
}
@@ -206,7 +207,7 @@ static void do_read(struct userdata *u) {
if ((r = pa_iochannel_read(u->io, memchunk.memblock->data, memchunk.memblock->length)) < 0) {
pa_memblock_unref(memchunk.memblock);
if (errno != EAGAIN)
- pa_log(__FILE__": read() failed: %s", strerror(errno));
+ pa_log(__FILE__": read() failed: %s", pa_cstrerror(errno));
return;
}
@@ -334,7 +335,7 @@ static int sink_set_hw_volume_cb(pa_sink *s) {
if (errno == EINVAL)
pa_log(__FILE__": AUDIO_SETINFO: Unsupported volume.");
else
- pa_log(__FILE__": AUDIO_SETINFO: %s", strerror(errno));
+ pa_log(__FILE__": AUDIO_SETINFO: %s", pa_cstrerror(errno));
return -1;
}
@@ -363,7 +364,7 @@ static int sink_set_hw_mute_cb(pa_sink *s) {
info.output_muted = !!s->hw_muted;
if (ioctl(u->fd, AUDIO_SETINFO, &info) < 0) {
- pa_log(__FILE__": AUDIO_SETINFO: %s", strerror(errno));
+ pa_log(__FILE__": AUDIO_SETINFO: %s", pa_cstrerror(errno));
return -1;
}
@@ -397,7 +398,7 @@ static int source_set_hw_volume_cb(pa_source *s) {
if (errno == EINVAL)
pa_log(__FILE__": AUDIO_SETINFO: Unsupported volume.");
else
- pa_log(__FILE__": AUDIO_SETINFO: %s", strerror(errno));
+ pa_log(__FILE__": AUDIO_SETINFO: %s", pa_cstrerror(errno));
return -1;
}
@@ -463,7 +464,7 @@ static int pa_solaris_auto_format(int fd, int mode, pa_sample_spec *ss) {
if (errno == EINVAL)
pa_log(__FILE__": AUDIO_SETINFO: Unsupported sample format.");
else
- pa_log(__FILE__": AUDIO_SETINFO: %s", strerror(errno));
+ pa_log(__FILE__": AUDIO_SETINFO: %s", pa_cstrerror(errno));
return -1;
}
@@ -481,7 +482,7 @@ static int pa_solaris_set_buffer(int fd, int buffer_size) {
if (errno == EINVAL)
pa_log(__FILE__": AUDIO_SETINFO: Unsupported buffer size.");
else
- pa_log(__FILE__": AUDIO_SETINFO: %s", strerror(errno));
+ pa_log(__FILE__": AUDIO_SETINFO: %s", pa_cstrerror(errno));
return -1;
}
diff --git a/src/modules/module-volume-restore.c b/src/modules/module-volume-restore.c
index e74567bc..796e43a3 100644
--- a/src/modules/module-volume-restore.c
+++ b/src/modules/module-volume-restore.c
@@ -32,6 +32,7 @@
#include <stdlib.h>
#include <ctype.h>
+#include <polyp/error.h>
#include <polyp/xmalloc.h>
#include <polypcore/module.h>
@@ -124,7 +125,7 @@ static int load_rules(struct userdata *u) {
pa_log_info(__FILE__": starting with empty ruleset.");
ret = 0;
} else
- pa_log(__FILE__": failed to open file '%s': %s", u->table_file, strerror(errno));
+ pa_log(__FILE__": failed to open file '%s': %s", u->table_file, pa_cstrerror(errno));
goto finish;
}
@@ -198,7 +199,7 @@ static int save_rules(struct userdata *u) {
pa_open_config_file(NULL, DEFAULT_VOLUME_TABLE_FILE, NULL, &u->table_file, "w");
if (!f) {
- pa_log(__FILE__": failed to open file '%s': %s", u->table_file, strerror(errno));
+ pa_log(__FILE__": failed to open file '%s': %s", u->table_file, pa_cstrerror(errno));
goto finish;
}
diff --git a/src/modules/oss-util.c b/src/modules/oss-util.c
index a84276f1..027921c5 100644
--- a/src/modules/oss-util.c
+++ b/src/modules/oss-util.c
@@ -34,6 +34,8 @@
#include <sys/stat.h>
#include <fcntl.h>
+#include <polyp/error.h>
+
#include <polypcore/core-util.h>
#include <polypcore/log.h>
@@ -51,7 +53,7 @@ int pa_oss_open(const char *device, int *mode, int* pcaps) {
tcaps = pcaps ? pcaps : &dcaps;
if (ioctl(fd, SNDCTL_DSP_GETCAPS, tcaps) < 0) {
- pa_log(__FILE__": SNDCTL_DSP_GETCAPS: %s", strerror(errno));
+ pa_log(__FILE__": SNDCTL_DSP_GETCAPS: %s", pa_cstrerror(errno));
goto fail;
}
@@ -65,13 +67,13 @@ int pa_oss_open(const char *device, int *mode, int* pcaps) {
if ((fd = open(device, (*mode = O_WRONLY)|O_NDELAY)) < 0) {
if ((fd = open(device, (*mode = O_RDONLY)|O_NDELAY)) < 0) {
- pa_log(__FILE__": open('%s'): %s", device, strerror(errno));
+ pa_log(__FILE__": open('%s'): %s", device, pa_cstrerror(errno));
goto fail;
}
}
} else {
if ((fd = open(device, *mode|O_NDELAY)) < 0) {
- pa_log(__FILE__": open('%s'): %s", device, strerror(errno));
+ pa_log(__FILE__": open('%s'): %s", device, pa_cstrerror(errno));
goto fail;
}
}
@@ -80,7 +82,7 @@ success:
if (pcaps) {
if (ioctl(fd, SNDCTL_DSP_GETCAPS, pcaps) < 0) {
- pa_log(__FILE__": SNDCTL_DSP_GETCAPS: %s", strerror(errno));
+ pa_log(__FILE__": SNDCTL_DSP_GETCAPS: %s", pa_cstrerror(errno));
goto fail;
}
}
@@ -118,7 +120,7 @@ int pa_oss_auto_format(int fd, pa_sample_spec *ss) {
if (ioctl(fd, SNDCTL_DSP_SETFMT, &format) < 0 || format != f) {
format = AFMT_U8;
if (ioctl(fd, SNDCTL_DSP_SETFMT, &format) < 0 || format != AFMT_U8) {
- pa_log(__FILE__": SNDCTL_DSP_SETFMT: %s", format != AFMT_U8 ? "No supported sample format" : strerror(errno));
+ pa_log(__FILE__": SNDCTL_DSP_SETFMT: %s", format != AFMT_U8 ? "No supported sample format" : pa_cstrerror(errno));
return -1;
} else
ss->format = PA_SAMPLE_U8;
@@ -130,7 +132,7 @@ int pa_oss_auto_format(int fd, pa_sample_spec *ss) {
channels = ss->channels;
if (ioctl(fd, SNDCTL_DSP_CHANNELS, &channels) < 0) {
- pa_log(__FILE__": SNDCTL_DSP_CHANNELS: %s", strerror(errno));
+ pa_log(__FILE__": SNDCTL_DSP_CHANNELS: %s", pa_cstrerror(errno));
return -1;
}
assert(channels);
@@ -138,7 +140,7 @@ int pa_oss_auto_format(int fd, pa_sample_spec *ss) {
speed = ss->rate;
if (ioctl(fd, SNDCTL_DSP_SPEED, &speed) < 0) {
- pa_log(__FILE__": SNDCTL_DSP_SPEED: %s", strerror(errno));
+ pa_log(__FILE__": SNDCTL_DSP_SPEED: %s", pa_cstrerror(errno));
return -1;
}
assert(speed);
@@ -164,7 +166,7 @@ int pa_oss_set_fragments(int fd, int nfrags, int frag_size) {
arg = ((int) nfrags << 16) | simple_log2(frag_size);
if (ioctl(fd, SNDCTL_DSP_SETFRAGMENT, &arg) < 0) {
- pa_log(__FILE__": SNDCTL_DSP_SETFRAGMENT: %s", strerror(errno));
+ pa_log(__FILE__": SNDCTL_DSP_SETFRAGMENT: %s", pa_cstrerror(errno));
return -1;
}
@@ -253,7 +255,7 @@ int pa_oss_get_hw_description(const char *dev, char *name, size_t l) {
!(f = fopen("/proc/asound/oss/sndstat", "r"))) {
if (errno != ENOENT)
- pa_log_warn(__FILE__": failed to open OSS sndstat device: %s", strerror(errno));
+ pa_log_warn(__FILE__": failed to open OSS sndstat device: %s", pa_cstrerror(errno));
return -1;
}
diff --git a/src/modules/rtp/module-rtp-recv.c b/src/modules/rtp/module-rtp-recv.c
index 56fc91ef..8d9b33c2 100644
--- a/src/modules/rtp/module-rtp-recv.c
+++ b/src/modules/rtp/module-rtp-recv.c
@@ -31,6 +31,7 @@
#include <string.h>
#include <unistd.h>
+#include <polyp/error.h>
#include <polyp/timeval.h>
#include <polyp/xmalloc.h>
@@ -216,13 +217,13 @@ static int mcast_socket(const struct sockaddr* sa, socklen_t salen) {
af = sa->sa_family;
if ((fd = socket(af, SOCK_DGRAM, 0)) < 0) {
- pa_log(__FILE__": Failed to create socket: %s", strerror(errno));
+ pa_log(__FILE__": Failed to create socket: %s", pa_cstrerror(errno));
goto fail;
}
one = 1;
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one)) < 0) {
- pa_log(__FILE__": SO_REUSEADDR failed: %s", strerror(errno));
+ pa_log(__FILE__": SO_REUSEADDR failed: %s", pa_cstrerror(errno));
goto fail;
}
@@ -239,12 +240,12 @@ static int mcast_socket(const struct sockaddr* sa, socklen_t salen) {
}
if (r < 0) {
- pa_log_info(__FILE__": Joining mcast group failed: %s", strerror(errno));
+ pa_log_info(__FILE__": Joining mcast group failed: %s", pa_cstrerror(errno));
goto fail;
}
if (bind(fd, sa, salen) < 0) {
- pa_log(__FILE__": bind() failed: %s", strerror(errno));
+ pa_log(__FILE__": bind() failed: %s", pa_cstrerror(errno));
goto fail;
}
diff --git a/src/modules/rtp/module-rtp-send.c b/src/modules/rtp/module-rtp-send.c
index 1372414c..c8b3899a 100644
--- a/src/modules/rtp/module-rtp-send.c
+++ b/src/modules/rtp/module-rtp-send.c
@@ -32,6 +32,7 @@
#include <string.h>
#include <unistd.h>
+#include <polyp/error.h>
#include <polyp/timeval.h>
#include <polyp/util.h>
#include <polyp/xmalloc.h>
@@ -238,28 +239,28 @@ int pa__init(pa_core *c, pa_module*m) {
}
if ((fd = socket(af, SOCK_DGRAM, 0)) < 0) {
- pa_log(__FILE__": socket() failed: %s", strerror(errno));
+ pa_log(__FILE__": socket() failed: %s", pa_cstrerror(errno));
goto fail;
}
if (connect(fd, af == AF_INET ? (struct sockaddr*) &sa4 : (struct sockaddr*) &sa6, af == AF_INET ? sizeof(sa4) : sizeof(sa6)) < 0) {
- pa_log(__FILE__": connect() failed: %s", strerror(errno));
+ pa_log(__FILE__": connect() failed: %s", pa_cstrerror(errno));
goto fail;
}
if ((sap_fd = socket(af, SOCK_DGRAM, 0)) < 0) {
- pa_log(__FILE__": socket() failed: %s", strerror(errno));
+ pa_log(__FILE__": socket() failed: %s", pa_cstrerror(errno));
goto fail;
}
if (connect(sap_fd, af == AF_INET ? (struct sockaddr*) &sap_sa4 : (struct sockaddr*) &sap_sa6, af == AF_INET ? sizeof(sap_sa4) : sizeof(sap_sa6)) < 0) {
- pa_log(__FILE__": connect() failed: %s", strerror(errno));
+ pa_log(__FILE__": connect() failed: %s", pa_cstrerror(errno));
goto fail;
}
if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP, &loop, sizeof(loop)) < 0 ||
setsockopt(sap_fd, IPPROTO_IP, IP_MULTICAST_LOOP, &loop, sizeof(loop)) < 0) {
- pa_log(__FILE__": IP_MULTICAST_LOOP failed: %s", strerror(errno));
+ pa_log(__FILE__": IP_MULTICAST_LOOP failed: %s", pa_cstrerror(errno));
goto fail;
}
diff --git a/src/modules/rtp/rtp.c b/src/modules/rtp/rtp.c
index 23e84eb3..012d6578 100644
--- a/src/modules/rtp/rtp.c
+++ b/src/modules/rtp/rtp.c
@@ -36,6 +36,8 @@
#include <sys/filio.h>
#endif
+#include <polyp/error.h>
+
#include <polypcore/log.h>
#include "rtp.h"
@@ -124,7 +126,7 @@ int pa_rtp_send(pa_rtp_context *c, size_t size, pa_memblockq *q) {
if (k < 0) {
if (errno != EAGAIN) /* If the queue is full, just ignore it */
- pa_log(__FILE__": sendmsg() failed: %s", strerror(errno));
+ pa_log(__FILE__": sendmsg() failed: %s", pa_cstrerror(errno));
return -1;
}
@@ -162,7 +164,7 @@ int pa_rtp_recv(pa_rtp_context *c, pa_memchunk *chunk, pa_memblock_stat *st) {
chunk->memblock = NULL;
if (ioctl(c->fd, FIONREAD, &size) < 0) {
- pa_log(__FILE__": FIONREAD failed: %s", strerror(errno));
+ pa_log(__FILE__": FIONREAD failed: %s", pa_cstrerror(errno));
goto fail;
}
@@ -183,7 +185,7 @@ int pa_rtp_recv(pa_rtp_context *c, pa_memchunk *chunk, pa_memblock_stat *st) {
m.msg_flags = 0;
if ((r = recvmsg(c->fd, &m, 0)) != size) {
- pa_log(__FILE__": recvmsg() failed: %s", r < 0 ? strerror(errno) : "size mismatch");
+ pa_log(__FILE__": recvmsg() failed: %s", r < 0 ? pa_cstrerror(errno) : "size mismatch");
goto fail;
}
diff --git a/src/modules/rtp/sap.c b/src/modules/rtp/sap.c
index 5b8f31fb..238ee420 100644
--- a/src/modules/rtp/sap.c
+++ b/src/modules/rtp/sap.c
@@ -38,6 +38,7 @@
#include <sys/filio.h>
#endif
+#include <polyp/error.h>
#include <polyp/xmalloc.h>
#include <polypcore/core-util.h>
@@ -77,7 +78,7 @@ int pa_sap_send(pa_sap_context *c, int goodbye) {
int k;
if (getsockname(c->fd, sa, &salen) < 0) {
- pa_log("getsockname() failed: %s\n", strerror(errno));
+ pa_log("getsockname() failed: %s\n", pa_cstrerror(errno));
return -1;
}
@@ -109,7 +110,7 @@ int pa_sap_send(pa_sap_context *c, int goodbye) {
m.msg_flags = 0;
if ((k = sendmsg(c->fd, &m, MSG_DONTWAIT)) < 0)
- pa_log("sendmsg() failed: %s\n", strerror(errno));
+ pa_log("sendmsg() failed: %s\n", pa_cstrerror(errno));
return k;
}
@@ -136,7 +137,7 @@ int pa_sap_recv(pa_sap_context *c, int *goodbye) {
assert(goodbye);
if (ioctl(c->fd, FIONREAD, &size) < 0) {
- pa_log(__FILE__": FIONREAD failed: %s", strerror(errno));
+ pa_log(__FILE__": FIONREAD failed: %s", pa_cstrerror(errno));
goto fail;
}
@@ -158,7 +159,7 @@ int pa_sap_recv(pa_sap_context *c, int *goodbye) {
m.msg_flags = 0;
if ((r = recvmsg(c->fd, &m, 0)) != size) {
- pa_log(__FILE__": recvmsg() failed: %s", r < 0 ? strerror(errno) : "size mismatch");
+ pa_log(__FILE__": recvmsg() failed: %s", r < 0 ? pa_cstrerror(errno) : "size mismatch");
goto fail;
}