]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Remove condition that was impossible.
authorJason Parker <jparker@digium.com>
Tue, 12 Feb 2008 22:22:54 +0000 (22:22 +0000)
committerJason Parker <jparker@digium.com>
Tue, 12 Feb 2008 22:22:54 +0000 (22:22 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@103503 65c4cc65-6c06-0410-ace0-fbb531ad65f3

contrib/scripts/safe_asterisk
main/asterisk.c

index 54d36df60d8a04b1375da793f8067df419931baf..14d9b35ec740eb99b26e0d2aa1f09ae41aeca75d 100644 (file)
@@ -149,18 +149,13 @@ run_asterisk()
                                mv /tmp/core ${DUMPDROP}/core.`hostname`-`date -Iseconds` &
                        fi
                else
-                       if [ "${EXITSTATUS}" = "0" ]; then
-                               echo "Asterisk ended normally.  Aborting."
-                               exit 0
-                       else
-                               echo "Asterisk died with code $EXITSTATUS."
-
-                               PID=`cat ${ASTPIDFILE}`
-                               if [ -f /tmp/core.${PID} ]; then
-                                       mv /tmp/core.${PID} ${DUMPDROP}/core.`hostname`-`date -Iseconds` &
-                               elif [ -f /tmp/core ]; then
-                                       mv /tmp/core ${DUMPDROP}/core.`hostname`-`date -Iseconds` &
-                               fi
+                       echo "Asterisk died with code $EXITSTATUS."
+
+                       PID=`cat ${ASTPIDFILE}`
+                       if [ -f /tmp/core.${PID} ]; then
+                               mv /tmp/core.${PID} ${DUMPDROP}/core.`hostname`-`date -Iseconds` &
+                       elif [ -f /tmp/core ]; then
+                               mv /tmp/core ${DUMPDROP}/core.`hostname`-`date -Iseconds` &
                        fi
                fi
                echo "Automatically restarting Asterisk."
index ecfca97d4b7c713dcfecf3ba34dff3c8377d7988..52266b455a37f9c9c03c29b5307aaec0d33e3762 100644 (file)
@@ -1721,7 +1721,8 @@ static int ast_el_read_char(EditLine *el, char *cp)
        struct pollfd fds[2];
        int res;
        int max;
-       char buf[512];
+#define EL_BUF_SIZE 512
+       char buf[EL_BUF_SIZE];
 
        for (;;) {
                max = 1;
@@ -1784,7 +1785,7 @@ static int ast_el_read_char(EditLine *el, char *cp)
                        if (!ast_opt_exec && !lastpos)
                                write(STDOUT_FILENO, "\r", 1);
                        write(STDOUT_FILENO, buf, res);
-                       if ((buf[res-1] == '\n') || (buf[res-2] == '\n')) {
+                       if ((res < EL_BUF_SIZE - 1) && ((buf[res-1] == '\n') || (buf[res-2] == '\n'))) {
                                *cp = CC_REFRESH;
                                return(1);
                        } else {