strange behaviour with background process.

lars lars at myab.UUCP
Tue Jul 23 09:43:32 AEST 1985


I am running on SVR2 and tried to make the following program to work. It
almost works (prints done every 10'th second), but whenever I press the
interrupt key to stop some program, the interrupt is caught by this
program. If I press the 'quit' key, a core is dumped.

I even tried the following: run 'sh', start the program, stop the
'sh' and the hit the 'intr' key. It was caught !

Is this a bug or a feature ?


The program:

#include <signal.h>

int interr();

main() {
    if (fork()) return;
    signal(SIGINT, interr);
    while (1) {
	sleep(10);
	printf("done\n");
    }
}

interr() {
    signal(SIGINT, interr);
    printf("int\n");
}
-- 
    ______________________________________________________
	Lars Pensjo
	{decvax,philabs}!mcvax!enea!chalmers!myab!lars



More information about the Comp.unix.wizards mailing list