Changeset View
Changeset View
Standalone View
Standalone View
contrib/tcp_wrappers/safe_finger.c
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | |||||
void cleanup(sig) | void cleanup(sig) | ||||
int sig; | int sig; | ||||
{ | { | ||||
kill(finger_pid, SIGKILL); | kill(finger_pid, SIGKILL); | ||||
exit(0); | exit(0); | ||||
} | } | ||||
main(argc, argv) | main(int argc, char **argv) | ||||
int argc; | |||||
char **argv; | |||||
{ | { | ||||
int c; | int c; | ||||
int line_length = 0; | int line_length = 0; | ||||
int finger_status; | int finger_status; | ||||
int wait_pid; | int wait_pid; | ||||
int input_count = 0; | int input_count = 0; | ||||
struct passwd *pwd; | struct passwd *pwd; | ||||
▲ Show 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | if (c == '\n') { /* good: end of line */ | ||||
*/ | */ | ||||
while ((wait_pid = wait(&finger_status)) != -1 && wait_pid != finger_pid) | while ((wait_pid = wait(&finger_status)) != -1 && wait_pid != finger_pid) | ||||
/* void */ ; | /* void */ ; | ||||
return (wait_pid != finger_pid || finger_status != 0); | return (wait_pid != finger_pid || finger_status != 0); | ||||
} | } | ||||
/* perror_exit - report system error text and terminate */ | /* perror_exit - report system error text and terminate */ | ||||
void perror_exit(text) | void perror_exit(char *text) | ||||
char *text; | |||||
{ | { | ||||
perror(text); | perror(text); | ||||
exit(1); | exit(1); | ||||
} | } | ||||
/* pipe_stdin - pipe stdin through program (from my ANSI to OLD C converter) */ | /* pipe_stdin - pipe stdin through program (from my ANSI to OLD C converter) */ | ||||
int pipe_stdin(argv) | int pipe_stdin(char **argv) | ||||
char **argv; | |||||
{ | { | ||||
int pipefds[2]; | int pipefds[2]; | ||||
int pid; | int pid; | ||||
int i; | int i; | ||||
struct stat st; | struct stat st; | ||||
/* | /* | ||||
* The code that sets up the pipe requires that file descriptors 0,1,2 | * The code that sets up the pipe requires that file descriptors 0,1,2 | ||||
Show All 40 Lines |