This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: negative error status: gcc vs. cl


On Thu, 8 Jul 2004, Corinna Vinschen wrote:

> On Jul  8 11:49, Daniel Lungu wrote:
> > Feel like bash tcsh on Cygwin mess up with negative exit status from a cl
> > compiled .exe
>
> The answer is "don't do that".  Use positive values in the range from
> 0 to 255.  See
> http://www.opengroup.org/onlinepubs/009695399/functions/exit.html
>
> Corinna

Corinna,

Actually, it looks like another buglet in Cygwin.  The code in
spawn_guts() in spawn.cc (line 847 in CVS HEAD) simply binary-ORs the
exitcode value returned by GetExitCodeProcess with the "res" variable.
However, the "res" variable is also used to carry some flags, and a
negative exitcode, being a full DWORD, accidentally sets those, so all
sorts of havoc can potentially occur (and I'm surprised that all that
happens is the wrong exit code).

I could work on a patch, but just saying that the errorcode should be
binary-ANDed with 0xFF before being binary-ORed with "res" should be
faster.

HTH,
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]