[asterisk-commits] tilghman: branch 1.6.0 r118471 - in /branches/1.6.0: ./ main/asterisk.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue May 27 13:59:58 CDT 2008
Author: tilghman
Date: Tue May 27 13:59:57 2008
New Revision: 118471
URL: http://svn.digium.com/view/asterisk?view=rev&rev=118471
Log:
Merged revisions 118466 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
................
r118466 | tilghman | 2008-05-27 13:59:06 -0500 (Tue, 27 May 2008) | 16 lines
Merged revisions 118465 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r118465 | tilghman | 2008-05-27 13:58:09 -0500 (Tue, 27 May 2008) | 8 lines
NULL character should terminate only commands back to the core, not log
messages to the console.
(closes issue #12731)
Reported by: seanbright
Patches:
20080527__bug12731.diff.txt uploaded by Corydon76 (license 14)
Tested by: seanbright
........
................
Modified:
branches/1.6.0/ (props changed)
branches/1.6.0/main/asterisk.c
Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.
Modified: branches/1.6.0/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/asterisk.c?view=diff&rev=118471&r1=118470&r2=118471
==============================================================================
--- branches/1.6.0/main/asterisk.c (original)
+++ branches/1.6.0/main/asterisk.c Tue May 27 13:59:57 2008
@@ -800,9 +800,16 @@
free(ae);
}
+/* Sending commands from consoles back to the daemon requires a terminating NULL */
+static int fdsend(int fd, const char *s)
+{
+ return write(fd, s, strlen(s) + 1);
+}
+
+/* Sending messages from the daemon back to the display requires _excluding_ the terminating NULL */
static int fdprint(int fd, const char *s)
{
- return write(fd, s, strlen(s) + 1);
+ return write(fd, s, strlen(s));
}
/*! \brief NULL handler so we can collect the child exit status */
@@ -1924,7 +1931,7 @@
printf("%s", term_quit());
WELCOME_MESSAGE;
if (!ast_opt_mute)
- fdprint(ast_consock, "logger mute silent");
+ fdsend(ast_consock, "logger mute silent");
else
printf("log and verbose output currently muted ('logger mute' to unmute)\n");
break;
@@ -2228,7 +2235,7 @@
if (ast_opt_remote) {
snprintf(buf, sizeof(buf), "_COMMAND NUMMATCHES \"%s\" \"%s\"", lf->buffer, ptr);
- fdprint(ast_consock, buf);
+ fdsend(ast_consock, buf);
res = read(ast_consock, buf, sizeof(buf));
buf[res] = '\0';
nummatches = atoi(buf);
@@ -2240,7 +2247,7 @@
if (!(mbuf = ast_malloc(maxmbuf)))
return (char *)(CC_ERROR);
snprintf(buf, sizeof(buf), "_COMMAND MATCHESARRAY \"%s\" \"%s\"", lf->buffer, ptr);
- fdprint(ast_consock, buf);
+ fdsend(ast_consock, buf);
res = 0;
mbuf[0] = '\0';
while (!strstr(mbuf, AST_CLI_COMPLETE_EOF) && res != -1) {
@@ -2425,11 +2432,11 @@
pid = -1;
if (!data) {
snprintf(tmp, sizeof(tmp), "core set verbose atleast %d", option_verbose);
- fdprint(ast_consock, tmp);
+ fdsend(ast_consock, tmp);
snprintf(tmp, sizeof(tmp), "core set debug atleast %d", option_debug);
- fdprint(ast_consock, tmp);
+ fdsend(ast_consock, tmp);
if (!ast_opt_mute)
- fdprint(ast_consock, "logger mute silent");
+ fdsend(ast_consock, "logger mute silent");
else
printf("log and verbose output currently muted ('logger mute' to unmute)\n");
}
More information about the asterisk-commits
mailing list