[asterisk-commits] bbryant: trunk r71067 - in /trunk: ./ main/asterisk.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jun 22 09:56:36 CDT 2007


Author: bbryant
Date: Fri Jun 22 09:56:36 2007
New Revision: 71067

URL: http://svn.digium.com/view/asterisk?view=rev&rev=71067
Log:
Merged revisions 71066 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r71066 | bbryant | 2007-06-22 09:53:08 -0500 (Fri, 22 Jun 2007) | 18 lines

Merged revisions 71064 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r71064 | bbryant | 2007-06-22 09:39:34 -0500 (Fri, 22 Jun 2007) | 10 lines

Fixed infinite loop when controlling terminal was lost
and return value of input function wasn't checked for
errors. This would cause 100% cpu to be taken up.

(closes issue #9654, issue #10010)
Reported by: mnicholson, and eserra

Idea for the patch from mnicholson, patched by me


........

................

Modified:
    trunk/   (props changed)
    trunk/main/asterisk.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/trunk/main/asterisk.c?view=diff&rev=71067&r1=71066&r2=71067
==============================================================================
--- trunk/main/asterisk.c (original)
+++ trunk/main/asterisk.c Fri Jun 22 09:56:36 2007
@@ -2232,6 +2232,9 @@
 	for (;;) {
 		ebuf = (char *)el_gets(el, &num);
 
+		if (!ebuf)
+			break;
+
 		if (!ast_strlen_zero(ebuf)) {
 			if (ebuf[strlen(ebuf)-1] == '\n')
 				ebuf[strlen(ebuf)-1] = '\0';
@@ -2957,12 +2960,14 @@
 
 		for (;;) {
 			buf = (char *)el_gets(el, &num);
-			if (buf) {
-				if (buf[strlen(buf)-1] == '\n')
-					buf[strlen(buf)-1] = '\0';
-
-				consolehandler((char *)buf);
-			} else if (ast_opt_remote && (write(STDOUT_FILENO, "\nUse EXIT or QUIT to exit the asterisk console\n",
+			if (!buf)
+				break;
+
+			if (buf[strlen(buf)-1] == '\n')
+				buf[strlen(buf)-1] = '\0';
+			consolehandler((char *)buf);
+
+			if (!buf && ast_opt_remote && (write(STDOUT_FILENO, "\nUse EXIT or QUIT to exit the asterisk console\n",
 				   strlen("\nUse EXIT or QUIT to exit the asterisk console\n")) < 0)) {
 				/* Whoa, stdout disappeared from under us... Make /dev/null's */
 				int fd;




More information about the asterisk-commits mailing list