Bug 83401 - checkpid function doesn't work for multiple pids
checkpid function doesn't work for multiple pids
Status: CLOSED ERRATA
Product: Red Hat Linux
Classification: Retired
Component: initscripts (Show other bugs)
8.0
All Linux
medium Severity low
: ---
: ---
Assigned To: Bill Nottingham
Brock Organ
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-02-03 17:44 EST by Tony Finch
Modified: 2014-03-16 22:34 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2003-02-03 22:08:02 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Tony Finch 2003-02-03 17:44:15 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.0.1) Gecko/20020912

Description of problem:
The comment before checkpid in /etc/rc.d/init.d/functions says
that it is supposed to work for multiple pids, but it returns
as soon as it finds any pid that is running. This isn't a problem
in practice because it is never invoked with more than one pid.


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


How reproducible:
Always

Steps to Reproduce:
$ bash
$ cd /etc/rc.d/init.d
$ . functions
$ checkpid 1 10000
$ echo $?
0
$ checkpid 10000
$ echo $?
1
$ ^D


Expected Results:  checkpid should return 0 if all of the pids are running
and 1 otherwise


Additional info:

The code should be

# Check if $pid (could be plural) are running
checkpid() {
        local i

        for i in $* ; do
                [ -d "/proc/$i" ] || return 1
        done
        return 0
}
Comment 1 Bill Nottingham 2003-02-03 22:08:02 EST
Fixed in cvs, will be in 7.07-1. Thanks!
Comment 2 John Flanagan 2003-12-19 14:13:49 EST
An errata has been issued which should help the problem described in this bug report. 
This report is therefore being closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files, please follow the link below. You may reopen 
this bug report if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2003-341.html

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