[quake3-bugzilla] [Bug 5080] [patch] code/sys/sys_unix.c:Sys_Dialog doesn't check exit codes properly

bugzilla-daemon at icculus.org bugzilla-daemon at icculus.org
Fri Jul 15 10:33:51 EDT 2011


https://bugzilla.icculus.org/show_bug.cgi?id=5080

Tim Angus <tim at ngus.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tim at ngus.net

--- Comment #3 from Tim Angus <tim at ngus.net> 2011-07-15 10:33:48 EDT ---
I agree regarding iterating over the system PATH variable; I don't think that's
a great idea. I think it would probably be enough just to change...

if( exitCode >= 0 )

...to...

if( exitCode >= 0 && exitCode < 64 )

The choice of 64 is rather arbitrary. This way the shell indicating the command
is not present is caught, but it still leaves plenty of numerical space incase
the return codes of the individual commands change (highly unlikely).

I think it's relatively safe to assume that a zero result from the command
means OK/Yes and a non-zero result means Cancel/No.

The less safe part is assuming that the shell itself returns something < 0 or
>= 64 if the command cannot be found/exectued, but I think in the grand scheme
of things that's still a fair assumption since in almost all cases system will
use something like /bin/sh.

Could you give this a try and see if it works for you?

-- 
Configure bugmail: https://bugzilla.icculus.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the quake3-bugzilla mailing list