Mailinglist Archive: yast-devel (105 mails)

< Previous Next >
Re: [yast-devel] [PATCH] yast2 exit codes
  • From: Stanislav Visnovsky <visnov@xxxxxxx>
  • Date: Thu, 25 Sep 2008 14:26:40 +0200
  • Message-id: <200809251426.40671.visnov@xxxxxxx>
Dňa Thursday 25 September 2008 14:23:09 Stefan Hundhammer ste napísal:
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.

Yes. Sounds like having the enum with standard ones in genericfrontend.cc is
not a good idea - we need header file and require all exit() calls to use
values from the enum there.

Stano
--
To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-devel+help@xxxxxxxxxxxx

< Previous Next >