Ignore:
Timestamp:
10/22/2007 17:19:50 (5 years ago)
Author:
arjun
Message:

Fixed the locking bug

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tags/confman-1.5.6a2/confmanlib.sh

    r173 r185  
    4747    else 
    4848        touch ${WORK_PATH}/confman.lock 
    49         echo $$ > "${WORK_PATH}/confman.lock" #Send PID to the lock to allow for recursive calls 
     49        echo $MY_PID > "${WORK_PATH}/confman.lock" #Send PID to the lock to allow for recursive calls 
    5050        return 0 
    5151    fi 
     
    6363    else 
    6464        touch ${WORK_PATH}/confman.lock 
    65         echo $$ > "${WORK_PATH}/confman.lock" #Send PID to the lock to allow for recursive calls 
     65        echo $MY_PID > "${WORK_PATH}/confman.lock" #Send PID to the lock to allow for recursive calls 
    6666        return 0 
    6767    fi 
     
    8282        sudo touch /var/run/confman.lock 
    8383        sudo chmod 666 /var/run/confman.lock 
    84         sudo echo $$ > "/var/run/confman.lock"  
    85         return 1 
     84        sudo echo $MY_PID > "/var/run/confman.lock"  
     85        return 0 
    8686    fi 
    8787} 
     
    9595 
    9696function conf_wcopy_locked? { 
    97     if [ -f ${WORK_PATH}/confman.lock ] 
    98     then 
     97    if [ -f ${WORK_PATH}/confman.lock ]  
     98    then 
     99        WCOPY_LOCK_PID=`cat ${WORK_PATH}/confman.lock` #gets the PID of the confman instance that created the lock 
     100    else 
     101        return 1 
     102    fi 
     103    if [ $WCOPY_LOCK_PID = $MY_PID ]  
     104    then 
     105        return 1 
     106    else 
    99107        return 0 
    100     else 
    101         return 1 
    102108    fi 
    103109} 
     
    106112    if [ -f /var/run/confman.lock ] 
    107113    then 
     114        SYSTEM_LOCK_PID=`cat /var/run/confman.lock` #gets the PID of the confman instance that created the lock 
     115    else 
     116        return 1 
     117    fi 
     118    if [ $SYSTEM_LOCK_PID = $MY_PID ]  
     119    then 
     120        return 1 
     121    else 
    108122        return 0 
    109     else 
    110         return 1 
    111123    fi 
    112124} 
     
    417429        local group=$3 
    418430        local mode=$4 
    419         local workdir="/" 
     431        local workdir="" 
    420432        local directories=`echo "$directory" | sed 's:/: :g'` 
    421433        local dir 
Note: See TracChangeset for help on using the changeset viewer.