Bug 338 - OS layer - Replace calls to exit(1) with calls to FatalError
Summary: OS layer - Replace calls to exit(1) with calls to FatalError
Status: CLOSED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Server/General (show other bugs)
Version: unspecified
Hardware: x86 (IA32) All
: highest trivial
Assignee: Harold L Hunt II
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 213
  Show dependency treegraph
 
Reported: 2004-03-17 12:36 UTC by Harold L Hunt II
Modified: 2004-03-16 21:05 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Remove exit(1) calls from os/utils.c (833 bytes, patch)
2004-03-17 12:37 UTC, Harold L Hunt II
no flags Details | Splinter Review
Remove exit(1) calls from os/xdmcp.c (5.07 KB, patch)
2004-03-17 12:37 UTC, Harold L Hunt II
no flags Details | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Harold L Hunt II 2004-03-17 12:36:29 UTC
There are about 12 places in os/utils.c and os/xdmcp.c where a call is made to
exit(1), often in unison with a call to ErrorF.  Calling exit(1) directly
prevents the DDX layer from doing its thing in the OsVendorFatalError (on Cygwin
this is used to popup a message box point the user to support information).

All of these calls to exit(1) occur in functions and files where calls to
FatalError are also made, and some of these are as trivial as a command-line
argument being malformed (which has no reason for bypassing FatalError).

These patches leave intact the following valid calls to exit() in the OS layer:

1) utils.c/AutoResetServer - Looks to be intentional here.
2) utils.c/ProcessCommandLine - "-help" processing after UseMsg() returns.
3) utils.c/System,Popen,Fopen - After calls to fork().
4) log.c/AbortServer - Happens after AbortDDX is called, valid.
5) xdmcp.c - None (all direct calls to exit were removed).

I took care to preserve the placement of the ErrorF messages at the top of the
log file (sometimes printed above UseMsg output) and duplicated such message in
a final call to FatalError.  In simpler cases not involving other output I
directly replaced the ErrorF and exit calls with a single call to FatalError.

This patch has been build and run tested on Cygwin and I consider it extremely safe.

I will be committing this barring any unusually strong protest.

Harold
Comment 1 Harold L Hunt II 2004-03-17 12:37:23 UTC
Created attachment 142 [details] [review]
Remove exit(1) calls from os/utils.c
Comment 2 Harold L Hunt II 2004-03-17 12:37:48 UTC
Created attachment 143 [details] [review]
Remove exit(1) calls from os/xdmcp.c
Comment 3 Harold L Hunt II 2004-03-17 16:05:36 UTC
Yay, I already committed this and forgot about it.  CVS commit message below.

Harold


CVSROOT:	/cvs/xorg
Module name:	xc
Changes by:	harold@pdx.	04/03/02 11:27:34

Log message:
  Replace a handful of calls to ErrorF and exit(1) with a single call to
FatalError.  These direct calls to exit(1) made it impossible to do anything
ddx-specific in these cases; note that most of these calls occur during argument
processing.

Modified files:
      xc/programs/Xserver/os/:	Tag: XORG-RELEASE-1
        utils.c xdmcp.c 
  
  Revision      Changes    Path
  1.1.4.6.2.2   +3 -3      xc/programs/Xserver/os/utils.c
  1.1.4.5.2.1   +17 -33    xc/programs/Xserver/os/xdmcp.c


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.