|
Lines 41-46
Link Here
|
| 41 |
#include <fcntl.h> |
41 |
#include <fcntl.h> |
| 42 |
#include <paths.h> |
42 |
#include <paths.h> |
| 43 |
#include <unistd.h> |
43 |
#include <unistd.h> |
|
|
44 |
#include <signal.h> |
| 44 |
#include "un-namespace.h" |
45 |
#include "un-namespace.h" |
| 45 |
|
46 |
|
| 46 |
int |
47 |
int |
|
Lines 48-54
Link Here
|
| 48 |
int nochdir, noclose; |
49 |
int nochdir, noclose; |
| 49 |
{ |
50 |
{ |
| 50 |
int fd; |
51 |
int fd; |
|
|
52 |
struct sigaction sa_ign, sa_save; |
| 53 |
pid_t newgrp; |
| 51 |
|
54 |
|
|
|
55 |
sa_ign.sa_handler = SIG_IGN; |
| 56 |
sa_ign.sa_flags = 0; |
| 57 |
(void) sigaction(SIGHUP, &sa_ign, &sa_save); |
| 58 |
|
| 52 |
switch (fork()) { |
59 |
switch (fork()) { |
| 53 |
case -1: |
60 |
case -1: |
| 54 |
return (-1); |
61 |
return (-1); |
|
Lines 58-64
Link Here
|
| 58 |
_exit(0); |
65 |
_exit(0); |
| 59 |
} |
66 |
} |
| 60 |
|
67 |
|
| 61 |
if (setsid() == -1) |
68 |
newgrp = setsid(); |
|
|
69 |
(void) sigaction(SIGHUP, &sa_save, (struct sigaction *) 0); |
| 70 |
if (newgrp == -1) |
| 62 |
return (-1); |
71 |
return (-1); |
| 63 |
|
72 |
|
| 64 |
if (!nochdir) |
73 |
if (!nochdir) |