if( (lock = pkgInitRites( progname )) >= 0 )
{
/* ...and proceed, only if successful.
- * (Note that we don't capture the exit status from "climain()";
- * MS-Windows degenerate process model provides us with no viable
- * mechanism to pass it back to our parent, when the last rites
- * handler exits with a successful "exec()" call).
+ * A non-zero return value indicates that a fatal error occurred.
*/
- (void) climain( argc, argv );
+ int rc = climain( argc, argv );
/* We must release the mingw-get DLL code, BEFORE we invoke
* last rites processing, (otherwise the last rites clean-up
* handler exhibits abnormal behaviour when it is exec'd).
*/
FreeLibrary( my_dll );
- return pkgLastRites( lock, progname );
+ if (rc == 0)
+ return pkgLastRites( lock, progname );
+ else
+ {
+ (void) pkgLastRites( lock, progname );
+ return EXIT_FATAL;
+ }
}
/* If we get to here, then we failed to acquire a lock;
* we MUST abort!