Hi,

as ksh script like

  #!/bin/ksh
  echo starting ./testsig
  ./testsig
  echo ending

does not ignore SIGINT but does exit.  The bash and also all
bourne shell I know ignores as long the job ./testsig is
running which is that the jon its self receives the SIGINT.
To make this work correct with the ksh the scriptlet above
becomes

  #!/bin/ksh
  echo starting ./testsig
  trap '' SIGINT
  ./testsig
  trap - SIGINT
  echo ending

... but why isn't that done by the ksh its self?  Both ksh
scriplets can be called on the command line and interrupted
by Ctrl-C to send SIGINT from the keyboard.  The first scriplet
ends and the ./testsig job runs in background, the second
scriplet ignores SIGINT.

Could it be that the flag set in shtab_signals[] for SIGINT is
missing the SH_SIGDONE bit?  But even if added I do not see
how the signal could be suppressed in sh_fault() without
modifying the code.


     Werner

-- 
 Dr. Werner Fink <[EMAIL PROTECTED]>
 SuSE LINUX Products GmbH,  Maxfeldstrasse 5,  Nuernberg,  Germany
 GF: Markus Rex,  HRB 16746 (AG Nuernberg)
 phone: +49-911-740-53-0,  fax: +49-911-3206727,  www.opensuse.org
------------------------------------------------------------------
  "Having a smoking section in a restaurant is like having
          a peeing section in a swimming pool." -- Edward Burr
#include <stdio.h>
#include <signal.h>
#include <unistd.h>

static char *me;
static void myhandler(int);

int main(int argc, char **argv)
{
  struct sigaction act;
  me = argv[0];

  act.sa_handler = myhandler;
  act.sa_flags = 0;

  sigaction(SIGINT, &act, NULL);

  while (1) {
    sleep(1);
    fprintf(stderr, ".");
  }

  return 0;
}

void myhandler(int x)
{
  fprintf(stderr, "%s: Signal %d received.\n", me ? me : "testsig", x);
} 
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to