aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_alsa.c
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2008-11-01 18:22:39 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2008-11-01 18:22:39 +0000
commitea96823f2626e2a4178eec54f8a78a666d376ac1 (patch)
treed6fd63606de3355d2e0f7bb2ab751116095a1451 /channels/chan_alsa.c
parent1c4fdfd503883d806ba05da5d0e9156b54a4d51b (diff)
fix a bunch of potential problems found by gcc 4.3.x, primarily bare strings being passed to printf()-like functions and ignored results from read()/write() and friends
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@153337 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_alsa.c')
-rw-r--r--channels/chan_alsa.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/channels/chan_alsa.c b/channels/chan_alsa.c
index c45740ef1..eae5b6fa5 100644
--- a/channels/chan_alsa.c
+++ b/channels/chan_alsa.c
@@ -327,7 +327,9 @@ static void *sound_thread(void *unused)
}
#endif
if (FD_ISSET(sndcmd[0], &rfds)) {
- read(sndcmd[0], &cursound, sizeof(cursound));
+ if (read(sndcmd[0], &cursound, sizeof(cursound)) < 0) {
+ ast_log(LOG_WARNING, "read() failed: %s\n", strerror(errno));
+ }
silencelen = 0;
offset = 0;
sampsent = 0;
@@ -532,7 +534,9 @@ static int alsa_call(struct ast_channel *c, char *dest, int timeout)
ast_queue_frame(alsa.owner, &f);
ast_mutex_unlock(&alsa.owner->lock);
}
- write(sndcmd[1], &res, sizeof(res));
+ if (write(sndcmd[1], &res, sizeof(res)) < 0) {
+ ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno));
+ }
}
snd_pcm_prepare(alsa.icard);
snd_pcm_start(alsa.icard);
@@ -543,10 +547,12 @@ static int alsa_call(struct ast_channel *c, char *dest, int timeout)
static void answer_sound(void)
{
int res;
+
nosound = 1;
res = 4;
- write(sndcmd[1], &res, sizeof(res));
-
+ if (write(sndcmd[1], &res, sizeof(res)) < 0) {
+ ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno));
+ }
}
static int alsa_answer(struct ast_channel *c)
@@ -576,7 +582,9 @@ static int alsa_hangup(struct ast_channel *c)
if (!autoanswer) {
/* Congestion noise */
res = 2;
- write(sndcmd[1], &res, sizeof(res));
+ if (write(sndcmd[1], &res, sizeof(res)) < 0) {
+ ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno));
+ }
}
}
snd_pcm_drop(alsa.icard);
@@ -770,8 +778,11 @@ static int alsa_indicate(struct ast_channel *chan, int cond, const void *data, s
res = -1;
}
- if (res > -1)
- write(sndcmd[1], &res, sizeof(res));
+ if (res > -1) {
+ if (write(sndcmd[1], &res, sizeof(res)) < 0) {
+ ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno));
+ }
+ }
ast_mutex_unlock(&alsalock);