Skip to content
Snippets Groups Projects
Commit e325cb56 authored by an7s's avatar an7s
Browse files

use exit instead of return

Former-commit-id: 03f9cd908376c65a27446938956780675e76ba78
parent b24ab909
Branches
Tags
No related merge requests found
#!/bin/bash
#
#
# Returns success (0) only if the POV results in a new crash point
# Returns > 0 otherwise
#
# /techx_share/techx_umbrella/peasoup/security_transforms/tools/cgc_protect/is_new_pov.sh /home/vagrant/techx_work/0b32aa01_crash_filter/id:000049,sig:11,src:000007,op:arith8,pos:88,val:+9.10288.xml /home/vagrant/techx_work/0b32aa01_crash_filter/0b32aa01_01.crash.summary /home/vagrant/techx_work/0b32aa01_crash_filter/0b32aa01_01
#
POV_PATH=$1 # fully qualified path for POV
CRASH_SUMMARY=$2 # input/output: POV-->crash summary file
CRASH_SUMMARY=$2 # crash summary file
CGC_BIN=$3 # input cgc binary (@todo: handle multi-cbs)
cbtest=$CGC_UMBRELLA_DIR/scripts/techx-cb-test
timeout=20
delimiter="###"
log=`pwd`/tmp.log.$$
log=`pwd`/tmp.log
pov_base=`basename ${POV_PATH}`
binary=`basename $CGC_BIN`
......@@ -21,17 +25,17 @@ core=${binary_dir}/core
# lookup pov
tmp=`grep -F "${pov_base}${delimiter}" ${CRASH_SUMMARY}`
if [ $? -eq 0 ];then
return 1
if [ $? -eq 0 ]; then
exit 2
fi
# cleanup any stale core files
if [ -f $core ]; then
sudo rm $core 2>/dev/null
sudo rm $core &>/dev/null
fi
echo "sudo -E $cbtest --debug --xml ${pov_base} --timeout $timeout --directory ${binary_dir} --cb ${binary} --log $log"
sudo -E $cbtest --debug --xml ${pov_base} --timeout $timeout --directory ${binary_dir} --cb ${binary} --log $log
echo "sudo -E $cbtest --debug --xml ${POV_PATH} --timeout $timeout --directory ${binary_dir} --cb ${binary} --log $log"
sudo -E $cbtest --debug --xml ${POV_PATH} --timeout $timeout --directory ${binary_dir} --cb ${binary} --log $log
grep "core identified" $log
if [ $? -eq 0 ]; then
if [ -f $core ]; then
......@@ -39,16 +43,20 @@ if [ $? -eq 0 ]; then
sudo chown `whoami` $core
eip=`timeout $timeout $PEASOUP_HOME/tools/extract_eip_from_core.sh ${CGC_BIN} $core`
if [ $? -eq 0 ]; then
echo "$eip" >> $CRASH_SITES
return 0
tmp=`grep -F "${delimiter}$eip" ${CRASH_SUMMARY}`
if [ $? -eq 0 ]; then
exit 1
else
exit 0
fi
else
return 1
exit 1
fi
sudo rm $core 2>/dev/null
sudo rm $core &>/dev/null
else
return 1
exit 1
fi
else
return 1
exit 1
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment