]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
automerge commit
authorAutomerge Script <automerge@asterisk.org>
Thu, 2 Aug 2007 16:03:57 +0000 (16:03 +0000)
committerAutomerge Script <automerge@asterisk.org>
Thu, 2 Aug 2007 16:03:57 +0000 (16:03 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2-netsec@77937 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_macro.c
contrib/scripts/ast_grab_core
res/res_agi.c

index 4002a8b00381ef20049de39026e4c4de6fe82230..557155c71138e5dbdaf9aba8f49c2ffa8266f1ca 100644 (file)
@@ -482,9 +482,9 @@ static int macroif_exec(struct ast_channel *chan, void *data)
                        label_b++;
                }
                if (pbx_checkcondition(expr))
-                       macro_exec(chan, label_a);
+                       res = macro_exec(chan, label_a);
                else if (label_b) 
-                       macro_exec(chan, label_b);
+                       res = macro_exec(chan, label_b);
        } else
                ast_log(LOG_WARNING, "Invalid Syntax.\n");
 
index 8f405ebddf5fbeaadd9166d9cf9acf71e6b75c3b..4de519c7f852b1348bf0e91766e246047169d3eb 100644 (file)
@@ -3,8 +3,19 @@
 # lame quickie script to snarf a core of a hung asterisk process.
 # bugs to ast_grab_core, blinky-lights.org  (derrick daugherty)
 
+# we have found that gcore doesn't yield as useful a core file
+# as that yielded by a signal-caused core dump. So we are going to change
+# the strategy to sending a SEGV signal to the asterisk process,
+# and have it 'burn to the ground', leaving behind a core file.
+# the main difference is that you cannot control where the
+# core file will end up. We will assume that safe_asterisk was
+# used to start asterisk, and the core file should therefore end
+# up in /tmp (because safe_asterisk cd's there before starting asterisk).
+# if this is not the case, set DUMPDIR to the place where the core
+# file can be found.
+
 DATE=`date +%Y%m%d%H%M`
-DUMPDIR=/var/tmp
+DUMPDIR=/tmp
 HOSTNAME=`hostname`
 ADMINEMAIL="root@localhost"
 
@@ -27,20 +38,16 @@ echo \*\*\* WARNING \*\*\*  If the system is not already locked this will cause
 echo \*\*\* WARNING \*\*\*  process to STOP while memory is dumped to disk.
 echo
 
-/usr/bin/gdb > /dev/null << EOF
-       attach ${PID}
-       gcore ${DUMPDIR}/asterisk_${DATE}.core.${PID}
-       detach
-       quit
-EOF
+/usr/bin/kill -11 ${PID}
 
-echo Snarfed!  ${DUMPDIR}/asterisk_${DATE}.core.${PID}
+echo Snarfed!  ${DUMPDIR}/core.${PID}
 echo
 
 
 echo Trying for a backtrace of the captured core.
-/usr/bin/gdb /usr/sbin/asterisk ${DUMPDIR}/asterisk_${DATE}.core.${PID} > /tmp/gdb_dump.${PID} 2> /dev/null << EOF
+/usr/bin/gdb /usr/sbin/asterisk ${DUMPDIR}/core.${PID} > /tmp/gdb_dump.${PID} 2> /dev/null << EOF
 set prompt \n
+set print pretty\n
 echo --------------------------------------------------------------------------------\n
 echo INFO THREAD
 info thread
@@ -56,7 +63,7 @@ echo Done trying for a bt.
 
 
 echo Notifying admins of the core.
-/usr/bin/mail -s "${HOSTNAME} core dumped at ${DUMPDIR}/asterisk_${DATE}.core.${PID}" ${ADMINEMAIL} < /tmp/gdb_dump.${PID}
+/usr/bin/mail -s "${HOSTNAME} core dumped at ${DUMPDIR}/core.${PID}" ${ADMINEMAIL} < /tmp/gdb_dump.${PID}
 /bin/rm /tmp/gdb_dump.${PID}
 echo Done.
 echo
index 8a142c14cd219904bc472013dcb5eeaf21652c69..53cafd58c3ec24fddc07cd6fc5f4cb03ca2f07ee 100644 (file)
@@ -1103,7 +1103,8 @@ static int handle_exec(struct ast_channel *chan, AGI *agi, int argc, char **argv
        }
        fdprintf(agi->fd, "200 result=%d\n", res);
 
-       return res >= 0 ? RESULT_SUCCESS : RESULT_FAILURE;
+       /* Even though this is wrong, users are depending upon this result. */
+       return res;
 }
 
 static int handle_setcallerid(struct ast_channel *chan, AGI *agi, int argc, char **argv)