util.c (xinetd-2.3.15) | : | util.c (xinetd-2.3.15.4.tar.xz) | ||
---|---|---|---|---|
skipping to change at line 13 | skipping to change at line 13 | |||
* (c) Sections Copyright 1998-2001 by Rob Braun | * (c) Sections Copyright 1998-2001 by Rob Braun | |||
* All rights reserved. The file named COPYRIGHT specifies the terms | * All rights reserved. The file named COPYRIGHT specifies the terms | |||
* and conditions for redistribution. | * and conditions for redistribution. | |||
*/ | */ | |||
#include "config.h" | #include "config.h" | |||
#include <sys/types.h> | #include <sys/types.h> | |||
#include <stdlib.h> | #include <stdlib.h> | |||
#include <unistd.h> | #include <unistd.h> | |||
#include <ctype.h> | #include <ctype.h> | |||
#if defined (HAVE_SYS_SOCKET_H) | ||||
#include <sys/socket.h> | #include <sys/socket.h> | |||
#endif | ||||
/* | /* | |||
* The following ifdef is for TIOCNOTTY | * The following ifdef is for TIOCNOTTY | |||
*/ | */ | |||
#ifndef NO_TERMIOS | #ifndef NO_TERMIOS | |||
#ifdef HAVE_SYS_TERMIOS_H | ||||
#include <sys/termios.h> | #include <sys/termios.h> | |||
#endif | ||||
#ifdef HAVE_TERMIOS_H | ||||
#include <termios.h> | #include <termios.h> | |||
#endif | ||||
#else | #else | |||
#include <sys/ioctl.h> | #include <sys/ioctl.h> | |||
#endif | #endif | |||
#include <fcntl.h> | #include <fcntl.h> | |||
#ifdef HAVE_SYS_FILE_H | ||||
#include <sys/file.h> | #include <sys/file.h> | |||
#endif | ||||
#ifdef HAVE_SYS_IOCTL_H | ||||
#include <sys/ioctl.h> | #include <sys/ioctl.h> | |||
#endif | ||||
#include <memory.h> | #include <memory.h> | |||
#include <syslog.h> | #include <syslog.h> | |||
#include <errno.h> | #include <errno.h> | |||
#include "sio.h" | #include "sio.h" | |||
#include "str.h" | #include "str.h" | |||
#include "util.h" | #include "util.h" | |||
#include "msg.h" | #include "msg.h" | |||
skipping to change at line 169 | skipping to change at line 158 | |||
} | } | |||
} | } | |||
return( OK ) ; | return( OK ) ; | |||
} | } | |||
/* | /* | |||
* Disassociate from controlling terminal | * Disassociate from controlling terminal | |||
*/ | */ | |||
void no_control_tty(void) | void no_control_tty(void) | |||
{ | { | |||
#if !defined(HAVE_SETSID) | ||||
int fd ; | ||||
const char *func = "no_control_tty" ; | ||||
if ( ( fd = open( "/dev/tty", O_RDWR ) ) == -1 ) | ||||
msg( LOG_WARNING, func, "open of /dev/tty failed: %m" ) ; | ||||
else | ||||
{ | ||||
if ( ioctl( fd, TIOCNOTTY, (caddr_t)0 ) == -1 ) | ||||
msg( LOG_WARNING, func, "ioctl on /dev/tty failed: %m" ) ; | ||||
(void) Sclose( fd ) ; | ||||
} | ||||
(void) setpgrp( getpid(), 0 ) ; | ||||
#else | ||||
(void) setsid() ; | (void) setsid() ; | |||
#endif | ||||
} | } | |||
/* | /* | |||
* Write the whole buffer to the given file descriptor ignoring interrupts | * Write the whole buffer to the given file descriptor ignoring interrupts | |||
*/ | */ | |||
status_e write_buf( int fd, const char *buf, int len ) | status_e write_buf( int fd, const char *buf, int len ) | |||
{ | { | |||
int i ; | int i ; | |||
ssize_t cc; | ssize_t cc; | |||
End of changes. 10 change blocks. | ||||
26 lines changed or deleted | 0 lines changed or added |