Bug 440251 - Minor defect in nanny
Summary: Minor defect in nanny
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Cluster Suite
Classification: Retired
Component: piranha
Version: 4
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Marek Grac
QA Contact: Cluster QE
URL:
Whiteboard:
: 450166 (view as bug list)
Depends On: 439814
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-04-02 14:30 UTC by Marek Grac
Modified: 2009-04-16 20:36 UTC (History)
2 users (show)

Fixed In Version: RHBA-2008-0794
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-07-25 19:09:03 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2008:0794 0 normal SHIPPED_LIVE piranha bug fix and enhancement update 2008-07-25 19:08:36 UTC

Description Marek Grac 2008-04-02 14:30:42 UTC
+++ This bug was initially created as a clone of Bug #439814 +++

Description of problem:

In reviewing the nanny code I discovered what appears to be a minor coding 
defect:





char *
getExecOutput (int flags, char **argv, int timeout)
{
.......
        pipe (p);

        if (!(child = fork ())) {
                int stdin, stderr;
.........


                execvp (argv[0], argv);
                exit (1);
        }

        close (p[1]);

        alarm (timeout);

        needsKilling = child;
        sigprocmask (SIG_UNBLOCK, &sigs, &oldSigs);

        rc = waitpid (child, &status, 0);          <--------- rc
        sigprocmask (SIG_SETMASK, &oldSigs, NULL);
        needsKilling = 0;

        if (rc < 0) {
                if (rc == EINTR)                  <------------- bug!! Should be
errno!
                        piranha_log (flags, (char *)
                                     "unexpected return \"%s\" running the
following:");
                else
                        piranha_log (flags,
                                     (char *) "timeout running the following:");


The above code makes a check of rc as though it is an errno, this is incorrect,
the syscall
rc value will be -1 and errno would be set to EINTR, as per the waitpid man page:


........

RETURN VALUE
       wait(): on success, returns the process ID of the terminated child; on
error, -1 is returned.

       waitpid(): on success, returns the process ID of the child whose state
has changed; on error, -1 is returned;  if  WNO-
       HANG was specified and no child(ren) specified by pid has yet changed
state, then 0 is returned.

       waitid():  returns 0 on success or if WNOHANG was specified and no
child(ren) specified by id has yet changed state; on
       error, -1 is returned.

       Each of these calls sets errno to an appropriate value in the case of an
error.

Comment 1 RHEL Program Management 2008-04-02 16:48:35 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 2 Marek Grac 2008-04-04 09:58:27 UTC
Fixed in CVS

Comment 4 Marek Grac 2008-06-05 17:00:53 UTC
*** Bug 450166 has been marked as a duplicate of this bug. ***

Comment 6 errata-xmlrpc 2008-07-25 19:09:03 UTC
An advisory 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-2008-0794.html



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