Lines 108-114
Link Here
|
108 |
int s = 1; |
108 |
int s = 1; |
109 |
int k = 1; |
109 |
int k = 1; |
110 |
int i = 1; |
110 |
int i = 1; |
111 |
int j; |
111 |
int j,fd; |
112 |
|
112 |
|
113 |
/* |
113 |
/* |
114 |
* Ensure that fds 0, 1, 2 are open, to /dev/null if nowhere else. |
114 |
* Ensure that fds 0, 1, 2 are open, to /dev/null if nowhere else. |
Lines 118-125
Link Here
|
118 |
*/ |
118 |
*/ |
119 |
j=open("/dev/null",O_RDWR); |
119 |
j=open("/dev/null",O_RDWR); |
120 |
while ( j < 2 && j >= 0 ) j = dup(j); |
120 |
while ( j < 2 && j >= 0 ) j = dup(j); |
121 |
if ( j > 2 ) close(j); |
121 |
j = sysconf (_SC_OPEN_MAX); |
122 |
|
122 |
for (fd = 3; fd < j; fd++) close(fd); |
|
|
123 |
|
123 |
if ( geteuid() ) |
124 |
if ( geteuid() ) |
124 |
{ |
125 |
{ |
125 |
fprintf(stderr,"**** %s: not a superuser\n",argc[0]); |
126 |
fprintf(stderr,"**** %s: not a superuser\n",argc[0]); |