Move error reporting to a common function. Lot information about the

most recent revision / commit.

svn path=/trunk/; revision=44552
This commit is contained in:
Gerald Combs 2012-08-17 16:28:28 +00:00
parent f5ed684cf2
commit faf3cdf75d
2 changed files with 41 additions and 22 deletions

View File

@ -191,6 +191,24 @@ export MallocCheckHeapAbort=1
# Call abort() if an illegal free() call is made
export MallocBadFreeAbort=1
function exit_error() {
echo -e "\n ERROR"
echo -e "Processing failed. Capture info follows:\n"
echo " Input file: $CF"
if [ -d .svn ] ; then
echo -e "\nSubversion revision" >> $TMP_DIR/$ERR_FILE
svn log -l 1 >> $TMP_DIR/$ERR_FILE
elif [ -d .git ] ; then
echo -e "\nGit commit" >> $TMP_DIR/$ERR_FILE
svn log -l 1 >> $TMP_DIR/$ERR_FILE
fi
echo -e "stderr follows:\n"
cat $TMP_DIR/$ERR_FILE
exit 1
}
# Iterate over our capture files.
PASS=0
@ -220,13 +238,7 @@ while [ \( $PASS -lt $MAX_PASSES -o $MAX_PASSES -lt 1 \) -a $DONE -ne 1 ] ; do
continue
elif [ $RETVAL -ne 0 -a $DONE -ne 1 ] ; then
# Some other error
echo ""
echo " ERROR"
echo -e "Processing failed. Capture info follows:\n"
echo " Input file: $CF"
echo -e "stderr follows:\n"
cat $TMP_DIR/$ERR_FILE
exit 1
exit_error
fi
DISSECTOR_BUG=0
@ -261,13 +273,7 @@ while [ \( $PASS -lt $MAX_PASSES -o $MAX_PASSES -lt 1 \) -a $DONE -ne 1 ] ; do
if [ \( $RETVAL -ne 0 -o $DISSECTOR_BUG -ne 0 -o $VG_ERR_CNT -ne 0 \) \
-a $DONE -ne 1 ] ; then
echo ""
echo " ERROR"
echo -e "Processing failed. Capture info follows:\n"
echo " Output file: $TMP_DIR/$TMP_FILE"
echo -e "stderr follows:\n"
cat $TMP_DIR/$ERR_FILE
exit 1
exit_error
fi
echo " OK"

View File

@ -82,6 +82,25 @@ echo ""
trap "MAX_PASSES=1; echo 'Caught signal'" HUP INT TERM
function exit_error() {
echo -e "\n ERROR"
echo -e "Processing failed. Capture info follows:\n"
echo " Input file: $CF"
if [ -d .svn ] ; then
echo -e "\nSubversion revision" >> $TMP_DIR/$ERR_FILE
svn log -l 1 >> $TMP_DIR/$ERR_FILE
elif [ -d .git ] ; then
echo -e "\nGit commit" >> $TMP_DIR/$ERR_FILE
svn log -l 1 >> $TMP_DIR/$ERR_FILE
fi
echo -e "stderr follows:\n"
cat $TMP_DIR/$ERR_FILE
exit 1
}
# Iterate over our capture files.
PASS=0
while [ $PASS -lt $MAX_PASSES -o $MAX_PASSES -lt 1 ] ; do
@ -104,16 +123,10 @@ while [ $PASS -lt $MAX_PASSES -o $MAX_PASSES -lt 1 ] ; do
> /dev/null 2>&1 && DISSECTOR_BUG=1
if [ $RETVAL -ne 0 -o $DISSECTOR_BUG -ne 0 ] ; then
RAND_FILE="randpkt-`$DATE +%Y-%m-%d`-$$.pcap"
echo ""
echo " ERROR"
echo -e "Processing failed. Capture info follows:\n"
mv $TMP_DIR/$TMP_FILE $TMP_DIR/$RAND_FILE
echo " Output file: $TMP_DIR/$RAND_FILE"
if [ $DISSECTOR_BUG -ne 0 ] ; then
echo -e "stderr follows:\n"
cat $TMP_DIR/$ERR_FILE
fi
exit 1
exit_error
fi
echo " OK"
rm -f $TMP_DIR/$TMP_FILE $TMP_DIR/$ERR_FILE