Bug 439814 - Minor defect in nanny
Summary: Minor defect in nanny
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: piranha
Version: 5.1
Hardware: All
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: Marek Grac
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: 440251 450166
TreeView+ depends on / blocked
 
Reported: 2008-03-31 15:44 UTC by Darren Lavender
Modified: 2023-09-14 01:12 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-01-20 20:54:49 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2009:0095 0 normal SHIPPED_LIVE piranha bug-fix and enhancement update 2009-01-20 16:04:31 UTC

Description Darren Lavender 2008-03-31 15:44:13 UTC
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 3 Chris Ward 2008-11-28 07:13:28 UTC
Partners, this bug should be fixed in the latest RHEL 5.3 Snapshot. We believe that you have some interest in its correct functionality, so we're making a friendly request to send us some testing feedback. 

If you have a chance to test it, please share with us your findings. If you have successfully VERIFIED the fix, please add PartnerVerified to the Bugzilla keywords, along with a description of the results. Thanks!

Comment 4 Chris Ward 2008-12-18 10:38:25 UTC
~~ Snapshot 6 is out ~~ Partners, please test and let us know if this bug has been fixed. Add PartnerVerified keyword if everything works as expected. For any new issues encountered, CLONE this bug and report the issues in the new bug.

Comment 6 errata-xmlrpc 2009-01-20 20:54:49 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 therefore 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-2009-0095.html

Comment 7 Red Hat Bugzilla 2023-09-14 01:12:15 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 1000 days


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