From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from localhost (fantadrom.bsd.lv [local]) by fantadrom.bsd.lv (OpenSMTPD) with ESMTPA id 43683887 for ; Fri, 8 Jul 2016 15:42:45 -0500 (EST) Date: Fri, 8 Jul 2016 15:42:45 -0500 (EST) Message-Id: <4935167243981661248.enqueue@fantadrom.bsd.lv> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: schwarze@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: mdocml: POSIX requires that a process calling tcsetpgrp(3) from the X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 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