source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: POSIX requires that a process calling tcsetpgrp(3) from the
@ 2016-07-08 20:42 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2016-07-08 20:42 UTC (permalink / raw)
  To: source

Log Message:
-----------
POSIX requires that a process calling tcsetpgrp(3) from the background
gets a SIGTTOU signal.  In that case, do not stop.
Portability issue found while testing on commercial Solaris 9/10/11.
Thanks to opencsw.org for providing me with a testing environment.

Modified Files:
--------------
    mdocml:
        tag.c

Revision Data
-------------
Index: tag.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/tag.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -Ltag.c -Ltag.c -u -p -r1.11 -r1.12
--- tag.c
+++ tag.c
@@ -57,6 +57,24 @@ tag_init(void)
 	tag_files.tfd = -1;
 	tag_files.tcpgid = -1;
 
+	/* Clean up when dying from a signal. */
+
+	memset(&sa, 0, sizeof(sa));
+	sigfillset(&sa.sa_mask);
+	sa.sa_handler = tag_signal;
+	sigaction(SIGHUP, &sa, NULL);
+	sigaction(SIGINT, &sa, NULL);
+	sigaction(SIGTERM, &sa, NULL);
+
+	/*
+	 * POSIX requires that a process calling tcsetpgrp(3)
+	 * from the background gets a SIGTTOU signal.
+	 * In that case, do not stop.
+	 */
+
+	sa.sa_handler = SIG_IGN;
+	sigaction(SIGTTOU, &sa, NULL);
+
 	/* Save the original standard output for use by the pager. */
 
 	if ((tag_files.ofd = dup(STDOUT_FILENO)) == -1)
@@ -68,12 +86,6 @@ tag_init(void)
 	    sizeof(tag_files.ofn));
 	(void)strlcpy(tag_files.tfn, "/tmp/man.XXXXXXXXXX",
 	    sizeof(tag_files.tfn));
-	memset(&sa, 0, sizeof(sa));
-	sigfillset(&sa.sa_mask);
-	sa.sa_handler = tag_signal;
-	sigaction(SIGHUP, &sa, NULL);
-	sigaction(SIGINT, &sa, NULL);
-	sigaction(SIGTERM, &sa, NULL);
 	if ((ofd = mkstemp(tag_files.ofn)) == -1)
 		goto fail;
 	if ((tag_files.tfd = mkstemp(tag_files.tfn)) == -1)
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-07-08 20:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-08 20:42 mdocml: POSIX requires that a process calling tcsetpgrp(3) from the schwarze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).