einval-on-wrong-args patch

Christopher Faylor cgf@redhat.com
Fri Feb 16 10:09:00 GMT 2001


On Fri, Feb 16, 2001 at 08:50:19PM +0300, Egor Duda wrote:
>Hi!
>
>Friday, 16 February, 2001 Christopher Faylor cgf@redhat.com wrote:
>
>>>  return  EINVAL  if  signal()  or  lseek()  are  called  with illegal
>>>arguments.
>
>CF> Either your signal() change is not quite right, or sigaction() is wrong.
>CF> sigaction() allows setting the handler for SIGKILL to SIG_DFL.  Is
>CF> that incorrect?  If not, then please modify your change (and check it in).
>CF> If it is the incorrect behavior, could you fix sigaction, too?
>
>SUSv2 is a bit vague on the subject, but this program
>
>#include <stdio.h>
>#include <signal.h>
>
>main ()
>{
>  struct sigaction act;
>  act.sa_handler = SIG_DFL;
>  act.sa_flags = 0;
>  act.sa_sigaction = NULL;
>  sigemptyset ( &act.sa_mask );
>  if ( signal ( SIGKILL, SIG_DFL ) == SIG_ERR ) perror ("signal" );
>  if ( sigaction ( SIGKILL, NULL, NULL ) ) perror ( "sigaction1" );
>  if ( sigaction ( SIGKILL, &act, NULL ) ) perror ( "sigaction2" );
>}
>
>when run on linux, prints
>
>signal: Invalid argument
>sigaction2: Invalid argument
>
>so  perhaps sigaction should be fixed. moreover, SUSv2 says that if we
>add SIGKILL or SIGSTOP to sa_mask, this should be silently ignored.

Hopefully that much is true, at least.

Would you mind checking in your patch and fixing sigaction to conform to
linux?

Thanks,
cgf



More information about the Cygwin-patches mailing list