Bug 112506 - Incorrect return code of condrestart in /etc/rc.d/init.d/named
Incorrect return code of condrestart in /etc/rc.d/init.d/named
Status: CLOSED RAWHIDE
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: bind (Show other bugs)
3.0
All Linux
low Severity low
: ---
: ---
Assigned To: Daniel Walsh
Ben Levenson
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-12-21 15:00 EST by NN Poster
Modified: 2007-11-30 17:06 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2003-12-29 06:42:31 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description NN Poster 2003-12-21 15:00:09 EST
Description of problem:
Action "condrestart" in /etc/init.d/rc.d/named will return incorrect 
code if a restart is not needed. This is due to the fact that the 
action is implemented as:
    [ -e /var/lock/subsys/named ] && restart
If the lock file exists then the return code of the action is equal 
to the return code of "restart", which is appropriate. However, if 
lock file does not exist then the return code of the action is equal 
to the return code of the failed test [ -e ... ], which is not 
appropriate.

Several fixes are possible:

1. Replace the action implementation with:
[ ! -e /var/lock/subsys/named ] || restart

2. Replace the action implementation with:
if [ -e /var/lock/subsys/named ]; then restart; fi

3. Change the script exit from "exit $?" to "exit $RETVAL".


Version-Release number of selected component (if applicable):
bind-9.2.2-21

How reproducible:
always when named is not running

Steps to Reproduce:
1. /etc/init.d/named stop
2. /etc/init.d/named condrestart
3. echo $?
  
Actual results:
1

Expected results:
0

Additional info:
Comment 1 NN Poster 2003-12-22 23:28:05 EST
Minor correction: The correct path is /etc/rc.d/init.d/named, 
not /etc/init.d/rc.d/named
Comment 2 Daniel Walsh 2003-12-29 06:42:31 EST
Fixed in bind-9.2.3-3 in rawhide.

Note You need to log in before you can comment on or make changes to this bug.