mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* exit command
@ 2010-03-04 14:38 Jan Weitzel
  0 siblings, 0 replies; only message in thread
From: Jan Weitzel @ 2010-03-04 14:38 UTC (permalink / raw)
  To: barebox

Hello
I am trying to fix a problem with the return value coming from exit within 
a if statement.
This test shows the problem:

barebox:/ cat ./tif 
if [ 1 -ne 0 ]; then
 echo in if
 exit 1
fi
barebox:/ ./tif
in if
barebox:/ echo $?
0

In common/hush.c run_list_real(struct pipe *pi) calls run_pipe_real(struct 
pipe *pi).
In function run_pipe_real(struct pipe *pi) line 540 a child pipe is 
started. This child pipe works fine and set a prober last_return_code. 
After return from run_list_real(struct pipe *pi) the return value -2 (Line 
702) is given from run_pipe_real(struct pipe *pi) to run_list_real(struct 
pipe *pi)  and here the right last_return_code will be overwritten.

exit is a command only modifying the wanted exit value r with "return -r - 
2". So here we have also -2 or -3 as return value.
Is the problem located in the line 700 "if (rcode < -1)" statement, or 
should exit be a reserved word to controls the flags? I am not sure why we 
need the father pipe.

Kind Regards
Dipl. Ing. (FH) Jan Weitzel

-Software Entwicklung-
PHYTEC Messtechnik GmbH
Robert-Koch-Str. 39
55129 Mainz
Tel.: +49 (0)6131 9221-0
Web: http://www.phytec.de

Geschäftsführer: Dipl.-Ing. Michael Mitezki, Handelsregister Mainz, HRB 
4656, Finanzamt Mainz-Mitte, St.Nr. 266500608, DE 149059855
This E-Mail may contain confidential or privileged information. If you are 
not the intended recipient (or have received this E-Mail in error) please 
notify the sender immediately and destroy this E-Mail. Any unauthorized
copying, disclosure or distribution of the material in this E-Mail is 
strictly forbidden.

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-03-04 14:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-04 14:38 exit command Jan Weitzel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox