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 83401 - checkpid function doesn't work for multiple pids
Summary: checkpid function doesn't work for multiple pids
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: initscripts
Version: 8.0
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: Brock Organ
Depends On:
TreeView+ depends on / blocked
Reported: 2003-02-03 22:44 UTC by Tony Finch
Modified: 2014-03-17 02:34 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2003-02-04 03:08:02 UTC

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2003:341 normal SHIPPED_LIVE New initscripts packages available 2003-12-19 05:00:00 UTC

Description Tony Finch 2003-02-03 22:44:15 UTC
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:

Steps to Reproduce:
$ bash
$ cd /etc/rc.d/init.d
$ . functions
$ checkpid 1 10000
$ echo $?
$ checkpid 10000
$ echo $?
$ ^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
        return 0

Comment 1 Bill Nottingham 2003-02-04 03:08:02 UTC
Fixed in cvs, will be in 7.07-1. Thanks!

Comment 2 John Flanagan 2003-12-19 19:13:49 UTC
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.

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