[comp.unix.wizards] Ignore interrupt in system

thompson@uxf.cso.uiuc.edu (09/07/89)

4.3 BSD on a Sequent, if that makes much of a difference.

I am writing a C-shell-script/C-program pair to securely allow handing in
 of programs by students.  One of the things I'd like to do is turn off
 the two keyboard-initiated interrupts over the critical handing-in portion
 of the code.  Last year, I got quite enough of the "but it was taking so long,
 I just stopped it, but I thought it was handed in...".

Luckily, the critical portion is in the C program.  So, I stuck:

signal (SIGINT,SIG_IGN);
signal (SIGQUIT,SIG_IGN);

at the top of the C program and figured I was fine.  But after tracking some
strange occurrences, I noticed that when I do the "system()" calls I need to
do later in the program, the signals are reset to be trapped normally in
the shell that's forked by system().  So if a student hits CTRL-C while it's
executing the system(), it's trapped, and I'm out of luck.

So, I need one of three things:

1. A way for my interrupt ignoring to be passed to my system() shells.
2. A way for me to set the interrupts to be ignored in the midst of my
	system() calls.
or
3. A way to "chmod" files from within a C program without using "system()".

Thanks in advance,


- Mark Thompson                       "The University Neither Knows Nor
"The less I seek my source for some     Cares What I Am Saying -- Lucky
 definitive, closer I am to fine."      Them."
  University of Illinois at U-C
  INTERNET: thompson@uxf.cso.uiuc.edu
  USMAILNET: 202 E Springfield #3B, Champaign IL 61820

cpcahil@virtech.UUCP (Conor P. Cahill) (09/11/89)

In article <46800009@uxf.cso.uiuc.edu>, thompson@uxf.cso.uiuc.edu writes:
> So, I need one of three things:
> 
> 3. A way to "chmod" files from within a C program without using "system()".

This, by far, would be the most optimal method to use, since it would only
require a single system call chmod(2) as opposed to a fork, exec of the shell,
fork, exec of the chmod program which will do a chmod(2) system call.

RTFM for usage of chmod(2).


-- 
+-----------------------------------------------------------------------+
| Conor P. Cahill     uunet!virtech!cpcahil      	703-430-9247	!
| Virtual Technologies Inc.,    P. O. Box 876,   Sterling, VA 22170     |
+-----------------------------------------------------------------------+