[asterisk-commits] rizzo: trunk r48083 - /trunk/main/manager.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Nov 28 06:08:56 MST 2006


Author: rizzo
Date: Tue Nov 28 07:08:56 2006
New Revision: 48083

URL: http://svn.digium.com/view/asterisk?view=rev&rev=48083
Log:
do not return 500 Internal error if the AMI command provides
no output.


Modified:
    trunk/main/manager.c

Modified: trunk/main/manager.c
URL: http://svn.digium.com/view/asterisk/trunk/main/manager.c?view=diff&rev=48083&r1=48082&r2=48083
==============================================================================
--- trunk/main/manager.c (original)
+++ trunk/main/manager.c Tue Nov 28 07:08:56 2006
@@ -2767,10 +2767,11 @@
 		char *buf;
 		off_t len = lseek(s->fd, 0, SEEK_END);	/* how many chars available */
 
-		if (len > 0 && (buf = ast_calloc(1, len+1))) {
+		/* always return something even if len == 0 */
+		if ((buf = ast_calloc(1, len+1))) {
 			if (!s->outputstr)
 				s->outputstr = ast_calloc(1, sizeof(*s->outputstr));
-			if (s->outputstr) {
+			if (len > 0 && s->outputstr) {
 				lseek(s->fd, 0, SEEK_SET);
 				read(s->fd, buf, len);
 				if (0)



More information about the asterisk-commits mailing list