daemon caching weird exit status from a shell script
- From: "brasilino@xxxxxxxxx" <brasilino@xxxxxxxxx>
- Date: 20 Mar 2007 12:48:55 -0700
Hi folks:
I'm developing a daemon written in C which will control some program
execution (something like init, but simpler),
and I'm getting something strange. I'm using fork() and execv() to
execute a bash script, for instance, and
the parent process is calling waitpid() to collect script exit status.
When the script ends with "exit 1" bash
instruction, waitpid() collects 256 as exit status, when it end with
"exit 2", 512 is collected. Seems that
the exit status from a bash script is seen as a more significant byte
within C daemon code and the
first byte is zeroed. Why? Is that right? What I done was to shift 8
bits right the exit status...
thanks for any information.
regards
Lucas Brasilino
* GNU bash, version 3.00.16(1)-release (i386-redhat-linux-gnu)
* gcc version 4.0.2 20051125 (Red Hat 4.0.2-8)
* glibc-2.3.6-3
* Fedora Core 4
.
- Follow-Ups:
- Re: daemon caching weird exit status from a shell script
- From: Jens Thoms Toerring
- Re: daemon caching weird exit status from a shell script
- Prev by Date: Re: no Hello World!!
- Next by Date: Re: Is splint the best for static code checking? I mean free.
- Previous by thread: no Hello World!!
- Next by thread: Re: daemon caching weird exit status from a shell script
- Index(es):
Relevant Pages
|