Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 160022 - daemon() in /etc/rc.d/init.d/functions returns incorrect value with --check option
Summary: daemon() in /etc/rc.d/init.d/functions returns incorrect value with --check o...
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: initscripts
Version: 3.0
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: Brock Organ
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-06-10 02:54 UTC by Kai-Min Sung
Modified: 2014-03-17 02:54 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-06-10 18:54:55 UTC


Attachments (Terms of Use)
Patch for /etc/rc.d/init.d/functions (deleted)
2005-06-10 02:54 UTC, Kai-Min Sung
no flags Details | Diff

Description Kai-Min Sung 2005-06-10 02:54:50 UTC
Description of problem:
The daemon() function in the file /etc/rc.d/init.d/functions is called by 
several init scripts to startup daemon processes. On success, this function 
prints "OK" to screen and returns the value 0. On failure, this function 
prints "FAILED" to screen and returns the value 1.

The --check option can be used to specify a pid file in the /var/run directory 
to check if a process with that pid is still running. If the --check option is 
specified and the process is still alive, the daemon() function silently 
calls "return" with no argument, which results in a return value of 0 
(success) in this case.

I believe the correct return value in this situation should be 1 (failure), 
since it is considered an error when trying to startup a daemon process that 
is still running. Furthermore, before returning from this failure the function 
should print to screen "FAILED".

Version-Release number of selected component (if applicable):
initscripts-7.31.22

How reproducible:
always

Steps to Reproduce:
1. Create an init script which calls "daemon --check program" on startup
2. Run the init script twice to startup the program
  
Actual results:
The second time the init script is run, the daemon function returns success 
but no "OK" or "FAILED" message is printed to screen.

Expected results:
The daemon function should return false the second time it is run and 
print "FAILED" to screen.

Additional info:
Attached is a patch for how I'd fix the issue

Comment 1 Kai-Min Sung 2005-06-10 02:54:51 UTC
Created attachment 115281 [details]
Patch for /etc/rc.d/init.d/functions

Comment 2 Bill Nottingham 2005-06-10 18:54:55 UTC
At this point, that's expected behavior; this isn't something we'd change for
RHEL 3.


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