Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37599801
en ru br
ALT Linux repos
S:1.0.8-alt3

Group :: Terminals
RPM: ttyrec

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

Patch: 11_sigaction.diff
Download


Description: Use sigaction (instead of signal)
 BSD semantics has SA_RESTART, which kills a part of behaviors of ttyrec.
 Use sigaction for better control.
  * doinput should be interrupted
  * dooutput should not be interrupted
Auther: NIIBE Yutaka <gniibe@fsij.org>
Suggested-By: Joey Hess <joeyh@debian.org>
Reviewed-By: NIIBE Yutaka <gniibe@fsij.org>
Last-Update: 2010-04-27
--- ttyrec-1.0.8.orig/ttyrec.c	2010-04-27 12:37:27.000000000 +0900
+++ ttyrec-1.0.8/ttyrec.c	2010-04-27 12:45:18.000000000 +0900
@@ -125,6 +125,7 @@
 	int argc;
 	char *argv[];
 {
+	struct sigaction sa;
 	extern int optind;
 	int ch;
 	void finish();
@@ -168,7 +169,10 @@
 	getmaster();
 	fixtty();
 
-	(void) signal(SIGCHLD, finish);
+	sigemptyset(&sa.sa_mask);
+	sa.sa_flags = 0;
+	sa.sa_handler = finish;
+	sigaction(SIGCHLD, &sa, NULL);
 	child = fork();
 	if (child < 0) {
 		perror("fork");
@@ -180,12 +184,16 @@
 			perror("fork");
 			fail();
 		}
-		if (child)
+		if (child) {
+			sa.sa_flags = SA_RESTART;
+			sigaction(SIGCHLD, &sa, NULL);
 			dooutput();
-		else
+		} else
 			doshell(command);
 	}
-	signal(SIGWINCH, resize);
+	sa.sa_handler = resize;
+	sa.sa_flags = SA_RESTART;
+	sigaction(SIGWINCH, &sa, NULL);
 	doinput();
 
 	return 0;
 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin