mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-30 02:26:23 +00:00
Merged revisions 284280 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.6.2 ........ r284280 | tilghman | 2010-08-30 17:27:06 -0500 (Mon, 30 Aug 2010) | 11 lines Fix 3 coding errors: 1) After we close FD, we should not be trying to write to it. 2) Call _exit(0), not exit(0), to avoid running shutdown routines in a child. 3) Use endian, not processor, detection to ensure bytes are written in the correct order. (closes issue #15706) Reported by: modelnine Patches: asterisk-1.6.1.1-festival-debug.patch uploaded by modelnine (license 865) Tested by: gmartinez ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@284281 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -49,6 +49,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||||||
#include "asterisk/utils.h"
|
#include "asterisk/utils.h"
|
||||||
#include "asterisk/lock.h"
|
#include "asterisk/lock.h"
|
||||||
#include "asterisk/app.h"
|
#include "asterisk/app.h"
|
||||||
|
#include "asterisk/endian.h"
|
||||||
|
|
||||||
#define FESTIVAL_CONFIG "festival.conf"
|
#define FESTIVAL_CONFIG "festival.conf"
|
||||||
#define MAXLEN 180
|
#define MAXLEN 180
|
||||||
@@ -127,7 +128,7 @@ static char *socket_receive_file_to_buff(int fd, int *size)
|
|||||||
static int send_waveform_to_fd(char *waveform, int length, int fd)
|
static int send_waveform_to_fd(char *waveform, int length, int fd)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
#ifdef __PPC__
|
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||||
int x;
|
int x;
|
||||||
char c;
|
char c;
|
||||||
#endif
|
#endif
|
||||||
@@ -142,7 +143,7 @@ static int send_waveform_to_fd(char *waveform, int length, int fd)
|
|||||||
ast_close_fds_above_n(0);
|
ast_close_fds_above_n(0);
|
||||||
if (ast_opt_high_priority)
|
if (ast_opt_high_priority)
|
||||||
ast_set_priority(0);
|
ast_set_priority(0);
|
||||||
#ifdef __PPC__
|
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||||
for (x = 0; x < length; x += 2) {
|
for (x = 0; x < length; x += 2) {
|
||||||
c = *(waveform + x + 1);
|
c = *(waveform + x + 1);
|
||||||
*(waveform + x + 1) = *(waveform + x);
|
*(waveform + x + 1) = *(waveform + x);
|
||||||
@@ -150,12 +151,12 @@ static int send_waveform_to_fd(char *waveform, int length, int fd)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (write(fd, waveform, length) < 0) {
|
if (write(0, waveform, length) < 0) {
|
||||||
ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno));
|
/* Cannot log -- all FDs are already closed */
|
||||||
}
|
}
|
||||||
|
|
||||||
close(fd);
|
close(fd);
|
||||||
exit(0);
|
_exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int send_waveform_to_channel(struct ast_channel *chan, char *waveform, int length, char *intkeys)
|
static int send_waveform_to_channel(struct ast_channel *chan, char *waveform, int length, char *intkeys)
|
||||||
|
Reference in New Issue
Block a user