Re: daemon caching weird exit status from a shell script



Hi Jens:

Have another look at the man page for waitpid(). The 'status'
you get back is a combination of the exit value of the program
and some additional information about the reasons the program
terminated (since there is not necessarily an exit value if the
process got killed e.g. due to an uncaught signal). Use the macro
WIFEXITED() on the 'status' value waitpid() reported and, if this
is true, you know there's an exit value and you can determine it
by using the WEXITSTATUS() on 'status'.

Thanks a lot. I was in a rush that I hadn't read the whole man page.
I think there's a mispelling there:

<snipet>
WEXITSTATUS(status)
evaluates to the least significant eight bits of the
return code
of the child which terminated, which may have been
set as the....
</snipet>

It evaluates the *most* significant eight bits... not the *least* one,
as I
could see.

bests regards
Lucas Brasilino

.



Relevant Pages

  • Re: Function return value
    ... couple of reasons. ... and reduces the amount of jumping about within a routine and reduces the total number of lines of code. ... There are cases where a single exit point would be advisable, such as where there is a need to restore global parameters prior to exit. ...
    (microsoft.public.word.vba.beginners)
  • Re: SYS$STARTUP:MMOV$SHUTDOWN.COM -- Insufficiently discriminating?
    ... > I've lost track of the reasons, ... I see a simmilar behaviour on my cluster. ... to exit their own building the call died. ...
    (comp.os.vms)
  • Re: Re: New http attack?
    ... ('binary' encoding is not supported, ... have hidden IP for obvious reasons. ... I managed to download the file myself manually, and submitted to symantec, as my virus checker didnt flag it. ...
    (Incidents)
  • Re: catching exit
    ... reuse it as a library. ... AFAIK there is no portable way to catch the exit. ... think of big chunks being made up of little chunks, ... But I have my reasons, ...
    (comp.lang.c)
  • Re: What is the difference is the placement of wait() here
    ... macros WIFEXITEDand WEXITSTATUS() since the status value you ... get from waitis a combination of the process' exit status ... and some more information about the reasons the process exited. ...
    (comp.unix.programmer)