1 /*
2  * pty_open_slave: open slave side of terminal, clearing for use.
3  *
4  * Copyright 1995 by the Massachusetts Institute of Technology.
5  *
6  *
7  * Permission to use, copy, modify, and distribute this software and
8  * its documentation for any purpose and without fee is hereby
9  * granted, provided that the above copyright notice appear in all
10  * copies and that both that copyright notice and this permission
11  * notice appear in supporting documentation, and that the name of
12  * M.I.T. not be used in advertising or publicity pertaining to
13  * distribution of the software without specific, written prior
14  * permission.  Furthermore if you modify this software you must label
15  * your software as modified software and not distribute it in such a
16  * fashion that it might be confused with the original M.I.T. software.
17  * M.I.T. makes no representations about the suitability
18  * of this software for any purpose.  It is provided "as is" without
19  * express or implied warranty.
20  *
21  */
22 
23 #include "pty-int.h"
24 
ptyint_vhangup(void)25 void ptyint_vhangup(void)
26 {
27 #ifdef HAVE_VHANGUP
28 #ifdef POSIX_SIGNALS
29     struct sigaction sa;
30     /* Initialize "sa" structure. */
31     (void) sigemptyset(&sa.sa_mask);
32     sa.sa_flags = 0;
33 
34 #endif
35 
36 #ifdef POSIX_SIGNALS
37 	sa.sa_handler = SIG_IGN;
38 	(void) sigaction(SIGHUP, &sa, (struct sigaction *)0);
39 	vhangup();
40 	sa.sa_handler = SIG_DFL;
41 	(void) sigaction(SIGHUP, &sa, (struct sigaction *)0);
42 #else
43 	signal(SIGHUP, SIG_IGN);
44 	vhangup();
45 	signal(SIGHUP, SIG_DFL);
46 #endif
47 #endif
48 }
49