On Donnerstag, 25. September 2008, Stanislav Visnovsky wrote:
Exit codes: 0 - everything fine 1 - too few arguments 5 - error in arguments 16 - generic client error 16 + x - client returned 'x' as exit code
By lucky coincidence, the UI uses exit codes that are consistent with this:
YUIComponent::setServerOptions(...)
{
...
else if ( strcmp( argv[i], "--macro" ) == 0 )
{
if ( i+1 >= argc )
{
y2error( "Missing arg for '--macro'" );
fprintf( stderr, "y2base: Missing argument for --macro\n" );
exit( 1 );
}
}
void YUI::topmostConstructorHasFinished()
{
...
if ( _withThreads )
{
if ( pipe( pipe_from_ui ) == 0 &&
pipe( pipe_to_ui ) == 0 )
{
...
}
else
{
yuiError() << "pipe() failed: errno: " << errno << " " << strerror(
errno ) << endl;
exit(2);
}
}
But we should remain aware that there might be more reasons for some part of
that complex framework to prematurely call exit(). Most of them are very
pathological cases, but they might still happen, and we should be careful to
avoid reporting them in misleading ways -- e.g., as "bad parameters" when
some syscall early in the start-up process failed.
CU
--
Stefan Hundhammer