mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jan Weitzel <J.Weitzel@phytec.de>
To: barebox@lists.infradead.org
Subject: exit command
Date: Thu, 4 Mar 2010 15:38:51 +0100	[thread overview]
Message-ID: <OF1C2EA0DF.7D33DE3B-ONC12576DC.004BDBF4-C12576DC.00507662@phytec.de> (raw)

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

                 reply	other threads:[~2010-03-04 14:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=OF1C2EA0DF.7D33DE3B-ONC12576DC.004BDBF4-C12576DC.00507662@phytec.de \
    --to=j.weitzel@phytec.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox