2005-01-20 Joel Sherrill <joel@OARcorp.com>

PR 736/pppd
	* libnetworking/pppd/chat.c, libnetworking/pppd/demand.c,
	libnetworking/pppd/pppd.h, libnetworking/pppd/rtemsmain.c,
	libnetworking/pppd/sys-rtems.c, libnetworking/pppd/utils.c: ttyfd
	should not be static and should have a name more specific to pppd.
This commit is contained in:
Joel Sherrill
2005-01-20 17:00:38 +00:00
parent 982c61cc67
commit 4ca43d72e1
13 changed files with 72 additions and 62 deletions

View File

@@ -1,3 +1,11 @@
2005-01-20 Joel Sherrill <joel@OARcorp.com>
PR 736/pppd
* libnetworking/pppd/chat.c, libnetworking/pppd/demand.c,
libnetworking/pppd/pppd.h, libnetworking/pppd/rtemsmain.c,
libnetworking/pppd/sys-rtems.c, libnetworking/pppd/utils.c: ttyfd
should not be static and should have a name more specific to pppd.
2005-01-07 Ralf Corsepius <ralf.corsepius@rtems.org> 2005-01-07 Ralf Corsepius <ralf.corsepius@rtems.org>
* libchip/Makefile.am, libnetworking/pppd/Makefile.am, * libchip/Makefile.am, libnetworking/pppd/Makefile.am,

View File

@@ -163,7 +163,7 @@ static int use_env = 0;
static int exit_code = 0; static int exit_code = 0;
static char *phone_num = (char *) 0; static char *phone_num = (char *) 0;
static char *phone_num2 = (char *) 0; static char *phone_num2 = (char *) 0;
static int ttyfd; /* static */ int pppd_ttyfd;
static int timeout = DEFAULT_CHAT_TIMEOUT; static int timeout = DEFAULT_CHAT_TIMEOUT;
#ifdef TERMIOS #ifdef TERMIOS
@@ -246,7 +246,7 @@ int chatmain(int fd, int mode, char *pScript)
/* initialize exit code */ /* initialize exit code */
exit_code = 0; exit_code = 0;
ttyfd = fd; pppd_ttyfd = fd;
script=pScript; script=pScript;
@@ -271,14 +271,14 @@ int chatmain(int fd, int mode, char *pScript)
} }
} }
} }
ttyfd = (int)-1; pppd_ttyfd = (int)-1;
return ( exit_code ); return ( exit_code );
} }
void break_sequence() void break_sequence()
{ {
tcsendbreak(ttyfd, 0); tcsendbreak(pppd_ttyfd, 0);
} }
/* /*
@@ -699,7 +699,7 @@ static int get_char()
while(tries) while(tries)
{ {
status = read(ttyfd, &c, 1); status = read(pppd_ttyfd, &c, 1);
switch (status) { switch (status) {
case 1: case 1:
return ((int)c & 0x7F); return ((int)c & 0x7F);
@@ -715,7 +715,7 @@ int c;
{ {
char ch = c; char ch = c;
return(write(ttyfd, &ch, 1)); return(write(pppd_ttyfd, &ch, 1));
} }
static int write_char (c) static int write_char (c)
@@ -791,10 +791,10 @@ register char *in_string;
memset(temp2, 0, sizeof(temp2)); memset(temp2, 0, sizeof(temp2));
tcgetattr(ttyfd, &tios); tcgetattr(pppd_ttyfd, &tios);
tios.c_cc[VMIN] = 0; tios.c_cc[VMIN] = 0;
tios.c_cc[VTIME] = timeout*10/MAX_TIMEOUTS; tios.c_cc[VTIME] = timeout*10/MAX_TIMEOUTS;
tcsetattr(ttyfd, TCSANOW, &tios); tcsetattr(pppd_ttyfd, TCSANOW, &tios);
string = clean(in_string, 0); string = clean(in_string, 0);
len = strlen(string); len = strlen(string);

View File

@@ -45,7 +45,7 @@
static const char rcsid[] = RCSID; static const char rcsid[] = RCSID;
static char *frame; static unsigned char *frame;
static int framelen; static int framelen;
static int framemax; static int framemax;
static int escape_flag; static int escape_flag;

View File

@@ -141,7 +141,7 @@ extern int pppd_kill_link; /* Signal to terminate processing loop */
extern int hungup; /* Physical layer has disconnected */ extern int hungup; /* Physical layer has disconnected */
extern int pppifunit; /* Interface unit number */ extern int pppifunit; /* Interface unit number */
extern char ifname[]; /* Interface name */ extern char ifname[]; /* Interface name */
extern int ttyfd; /* Serial device file descriptor */ extern int pppd_ttyfd; /* Serial device file descriptor */
extern char hostname[]; /* Our hostname */ extern char hostname[]; /* Our hostname */
extern u_char outpacket_buf[]; /* Buffer for outgoing packets */ extern u_char outpacket_buf[]; /* Buffer for outgoing packets */
extern int pppd_phase; /* Current state of link - see values below */ extern int pppd_phase; /* Current state of link - see values below */
@@ -301,7 +301,7 @@ void new_phase __P((int)); /* signal start of new phase */
/* Procedures exported from utils.c. */ /* Procedures exported from utils.c. */
void log_packet __P((u_char *, int, char *, int)); void log_packet __P((u_char *, int, char *, int));
/* Format a packet and log it with syslog */ /* Format a packet and log it with syslog */
void print_string __P((char *, int, void (*) (void *, char *, ...), void print_string __P((void *, int, void (*) (void *, char *, ...),
void *)); /* Format a string for output */ void *)); /* Format a string for output */
int slprintf __P((char *, int, char *, ...)); /* sprintf++ */ int slprintf __P((char *, int, char *, ...)); /* sprintf++ */
int vslprintf __P((char *, int, char *, va_list)); /* vsprintf++ */ int vslprintf __P((char *, int, char *, va_list)); /* vsprintf++ */

View File

@@ -77,7 +77,7 @@ int pppifunit; /* Interface unit number */
char hostname[MAXNAMELEN]; /* Our hostname */ char hostname[MAXNAMELEN]; /* Our hostname */
static char ppp_devnam[MAXPATHLEN]; /* name of PPP tty (maybe ttypx) */ static char ppp_devnam[MAXPATHLEN]; /* name of PPP tty (maybe ttypx) */
int ttyfd; /* Serial port file descriptor */ /* int pppd_ttyfd; * Serial port file descriptor */
int baud_rate; /* Actual bits/second for serial device */ int baud_rate; /* Actual bits/second for serial device */
int hungup; /* terminal has been hung up */ int hungup; /* terminal has been hung up */
int privileged; /* we're running as real uid root */ int privileged; /* we're running as real uid root */
@@ -232,7 +232,7 @@ pppdmain(argc, argv)
for (;;) { for (;;) {
need_holdoff = 1; need_holdoff = 1;
ttyfd = -1; pppd_ttyfd = -1;
real_ttyfd = -1; real_ttyfd = -1;
pppd_status = EXIT_OK; pppd_status = EXIT_OK;
++unsuccess; ++unsuccess;
@@ -264,9 +264,9 @@ pppdmain(argc, argv)
/* If the user specified the device name, become the /* If the user specified the device name, become the
user before opening it. */ user before opening it. */
int err; int err;
ttyfd = open(devnam, O_NONBLOCK | O_RDWR, 0); pppd_ttyfd = open(devnam, O_NONBLOCK | O_RDWR, 0);
err = errno; err = errno;
if (ttyfd >= 0) { if (pppd_ttyfd >= 0) {
break; break;
} }
errno = err; errno = err;
@@ -277,8 +277,8 @@ pppdmain(argc, argv)
if (!persist || err != EINTR) if (!persist || err != EINTR)
goto fail; goto fail;
} }
if ((fdflags = fcntl(ttyfd, F_GETFL)) == -1 if ((fdflags = fcntl(pppd_ttyfd, F_GETFL)) == -1
|| fcntl(ttyfd, F_SETFL, fdflags & ~O_NONBLOCK) < 0) || fcntl(pppd_ttyfd, F_SETFL, fdflags & ~O_NONBLOCK) < 0)
warn("Couldn't reset non-blocking mode on device: %m"); warn("Couldn't reset non-blocking mode on device: %m");
/* /*
@@ -291,9 +291,9 @@ pppdmain(argc, argv)
* successfully to the modem with CLOCAL clear and CD down, * successfully to the modem with CLOCAL clear and CD down,
* we could clear CLOCAL at this point. * we could clear CLOCAL at this point.
*/ */
set_up_tty(ttyfd, ((connector != NULL && connector[0] != 0) set_up_tty(pppd_ttyfd, ((connector != NULL && connector[0] != 0)
|| initializer != NULL)); || initializer != NULL));
real_ttyfd = ttyfd; real_ttyfd = pppd_ttyfd;
} }
/* run connection script */ /* run connection script */
@@ -308,7 +308,7 @@ pppdmain(argc, argv)
} }
if (initializer && initializer[0]) { if (initializer && initializer[0]) {
if (device_script(ttyfd, DIALER_INIT, initializer) < 0) { if (device_script(pppd_ttyfd, DIALER_INIT, initializer) < 0) {
error("Initializer script failed"); error("Initializer script failed");
pppd_status = EXIT_INIT_FAILED; pppd_status = EXIT_INIT_FAILED;
goto fail; goto fail;
@@ -320,7 +320,7 @@ pppdmain(argc, argv)
} }
if (connector && connector[0]) { if (connector && connector[0]) {
if (device_script(ttyfd, DIALER_CONNECT, connector) < 0) { if (device_script(pppd_ttyfd, DIALER_CONNECT, connector) < 0) {
error("Connect script failed"); error("Connect script failed");
pppd_status = EXIT_CONNECT_FAILED; pppd_status = EXIT_CONNECT_FAILED;
goto fail; goto fail;
@@ -360,12 +360,12 @@ pppdmain(argc, argv)
/* run welcome script, if any */ /* run welcome script, if any */
if (welcomer && welcomer[0]) { if (welcomer && welcomer[0]) {
if (device_script(ttyfd, DIALER_WELCOME, welcomer) < 0) if (device_script(pppd_ttyfd, DIALER_WELCOME, welcomer) < 0)
warn("Welcome script failed"); warn("Welcome script failed");
} }
/* set up the serial device as a ppp interface */ /* set up the serial device as a ppp interface */
fd_ppp = establish_ppp(ttyfd); fd_ppp = establish_ppp(pppd_ttyfd);
if (fd_ppp < 0) { if (fd_ppp < 0) {
pppd_status = EXIT_FATAL_ERROR; pppd_status = EXIT_FATAL_ERROR;
goto disconnect; goto disconnect;
@@ -415,7 +415,7 @@ pppdmain(argc, argv)
clean_check(); clean_check();
if (demand) if (demand)
restore_loop(); restore_loop();
disestablish_ppp(ttyfd); disestablish_ppp(pppd_ttyfd);
fd_ppp = -1; fd_ppp = -1;
if (!hungup) if (!hungup)
lcp_lowerdown(0); lcp_lowerdown(0);
@@ -429,7 +429,7 @@ pppdmain(argc, argv)
new_phase(PHASE_DISCONNECT); new_phase(PHASE_DISCONNECT);
if (real_ttyfd >= 0) if (real_ttyfd >= 0)
set_up_tty(real_ttyfd, 1); set_up_tty(real_ttyfd, 1);
if (device_script(ttyfd, DIALER_DISCONNECT, disconnect_script) < 0) { if (device_script(pppd_ttyfd, DIALER_DISCONNECT, disconnect_script) < 0) {
warn("disconnect script failed"); warn("disconnect script failed");
} else { } else {
info("Serial link disconnected."); info("Serial link disconnected.");
@@ -685,7 +685,7 @@ cleanup()
sys_cleanup(); sys_cleanup();
if (fd_ppp >= 0) if (fd_ppp >= 0)
disestablish_ppp(ttyfd); disestablish_ppp(pppd_ttyfd);
if (real_ttyfd >= 0) if (real_ttyfd >= 0)
close_tty(); close_tty();

View File

@@ -488,7 +488,7 @@ output(unit, p, len)
dbglog("sent %P", p, len); dbglog("sent %P", p, len);
/* printf("sent packet [%d]\n", len); */ /* printf("sent packet [%d]\n", len); */
if (write(ttyfd, p, len) < 0) { if (write(pppd_ttyfd, p, len) < 0) {
if (errno != EIO) if (errno != EIO)
error("write: %m"); error("write: %m");
} }
@@ -531,7 +531,7 @@ read_packet(buf)
{ {
int len; int len;
if ((len = read(ttyfd, buf, PPP_MTU + PPP_HDRLEN)) < 0) { if ((len = read(pppd_ttyfd, buf, PPP_MTU + PPP_HDRLEN)) < 0) {
if (errno == EWOULDBLOCK || errno == EINTR) len = -1; if (errno == EWOULDBLOCK || errno == EINTR) len = -1;
/*fatal("read: %m"); */ /*fatal("read: %m"); */
} }
@@ -649,7 +649,7 @@ ccp_test(unit, opt_ptr, opt_len, for_transmit)
data.ptr = opt_ptr; data.ptr = opt_ptr;
data.length = opt_len; data.length = opt_len;
data.transmit = for_transmit; data.transmit = for_transmit;
if (ioctl(ttyfd, PPPIOCSCOMPRESS, (caddr_t) &data) >= 0) if (ioctl(pppd_ttyfd, PPPIOCSCOMPRESS, (caddr_t) &data) >= 0)
return 1; return 1;
return (errno == ENOBUFS)? 0: -1; return (errno == ENOBUFS)? 0: -1;
} }

View File

@@ -468,13 +468,14 @@ pr_log __V((void *arg, char *fmt, ...))
* printer. * printer.
*/ */
void void
print_string(p, len, printer, arg) print_string(p_arg, len, printer, arg)
char *p; void *p_arg;
int len; int len;
void (*printer) __P((void *, char *, ...)); void (*printer) __P((void *, char *, ...));
void *arg; void *arg;
{ {
int c; int c;
unsigned char *p = (unsigned char *)p_arg;
printer(arg, "\""); printer(arg, "\"");
for (; len > 0; --len) { for (; len > 0; --len) {

View File

@@ -163,7 +163,7 @@ static int use_env = 0;
static int exit_code = 0; static int exit_code = 0;
static char *phone_num = (char *) 0; static char *phone_num = (char *) 0;
static char *phone_num2 = (char *) 0; static char *phone_num2 = (char *) 0;
static int ttyfd; /* static */ int pppd_ttyfd;
static int timeout = DEFAULT_CHAT_TIMEOUT; static int timeout = DEFAULT_CHAT_TIMEOUT;
#ifdef TERMIOS #ifdef TERMIOS
@@ -246,7 +246,7 @@ int chatmain(int fd, int mode, char *pScript)
/* initialize exit code */ /* initialize exit code */
exit_code = 0; exit_code = 0;
ttyfd = fd; pppd_ttyfd = fd;
script=pScript; script=pScript;
@@ -271,14 +271,14 @@ int chatmain(int fd, int mode, char *pScript)
} }
} }
} }
ttyfd = (int)-1; pppd_ttyfd = (int)-1;
return ( exit_code ); return ( exit_code );
} }
void break_sequence() void break_sequence()
{ {
tcsendbreak(ttyfd, 0); tcsendbreak(pppd_ttyfd, 0);
} }
/* /*
@@ -699,7 +699,7 @@ static int get_char()
while(tries) while(tries)
{ {
status = read(ttyfd, &c, 1); status = read(pppd_ttyfd, &c, 1);
switch (status) { switch (status) {
case 1: case 1:
return ((int)c & 0x7F); return ((int)c & 0x7F);
@@ -715,7 +715,7 @@ int c;
{ {
char ch = c; char ch = c;
return(write(ttyfd, &ch, 1)); return(write(pppd_ttyfd, &ch, 1));
} }
static int write_char (c) static int write_char (c)
@@ -791,10 +791,10 @@ register char *in_string;
memset(temp2, 0, sizeof(temp2)); memset(temp2, 0, sizeof(temp2));
tcgetattr(ttyfd, &tios); tcgetattr(pppd_ttyfd, &tios);
tios.c_cc[VMIN] = 0; tios.c_cc[VMIN] = 0;
tios.c_cc[VTIME] = timeout*10/MAX_TIMEOUTS; tios.c_cc[VTIME] = timeout*10/MAX_TIMEOUTS;
tcsetattr(ttyfd, TCSANOW, &tios); tcsetattr(pppd_ttyfd, TCSANOW, &tios);
string = clean(in_string, 0); string = clean(in_string, 0);
len = strlen(string); len = strlen(string);

View File

@@ -45,7 +45,7 @@
static const char rcsid[] = RCSID; static const char rcsid[] = RCSID;
static char *frame; static unsigned char *frame;
static int framelen; static int framelen;
static int framemax; static int framemax;
static int escape_flag; static int escape_flag;

View File

@@ -141,7 +141,7 @@ extern int pppd_kill_link; /* Signal to terminate processing loop */
extern int hungup; /* Physical layer has disconnected */ extern int hungup; /* Physical layer has disconnected */
extern int pppifunit; /* Interface unit number */ extern int pppifunit; /* Interface unit number */
extern char ifname[]; /* Interface name */ extern char ifname[]; /* Interface name */
extern int ttyfd; /* Serial device file descriptor */ extern int pppd_ttyfd; /* Serial device file descriptor */
extern char hostname[]; /* Our hostname */ extern char hostname[]; /* Our hostname */
extern u_char outpacket_buf[]; /* Buffer for outgoing packets */ extern u_char outpacket_buf[]; /* Buffer for outgoing packets */
extern int pppd_phase; /* Current state of link - see values below */ extern int pppd_phase; /* Current state of link - see values below */
@@ -301,7 +301,7 @@ void new_phase __P((int)); /* signal start of new phase */
/* Procedures exported from utils.c. */ /* Procedures exported from utils.c. */
void log_packet __P((u_char *, int, char *, int)); void log_packet __P((u_char *, int, char *, int));
/* Format a packet and log it with syslog */ /* Format a packet and log it with syslog */
void print_string __P((char *, int, void (*) (void *, char *, ...), void print_string __P((void *, int, void (*) (void *, char *, ...),
void *)); /* Format a string for output */ void *)); /* Format a string for output */
int slprintf __P((char *, int, char *, ...)); /* sprintf++ */ int slprintf __P((char *, int, char *, ...)); /* sprintf++ */
int vslprintf __P((char *, int, char *, va_list)); /* vsprintf++ */ int vslprintf __P((char *, int, char *, va_list)); /* vsprintf++ */

View File

@@ -77,7 +77,7 @@ int pppifunit; /* Interface unit number */
char hostname[MAXNAMELEN]; /* Our hostname */ char hostname[MAXNAMELEN]; /* Our hostname */
static char ppp_devnam[MAXPATHLEN]; /* name of PPP tty (maybe ttypx) */ static char ppp_devnam[MAXPATHLEN]; /* name of PPP tty (maybe ttypx) */
int ttyfd; /* Serial port file descriptor */ /* int pppd_ttyfd; * Serial port file descriptor */
int baud_rate; /* Actual bits/second for serial device */ int baud_rate; /* Actual bits/second for serial device */
int hungup; /* terminal has been hung up */ int hungup; /* terminal has been hung up */
int privileged; /* we're running as real uid root */ int privileged; /* we're running as real uid root */
@@ -232,7 +232,7 @@ pppdmain(argc, argv)
for (;;) { for (;;) {
need_holdoff = 1; need_holdoff = 1;
ttyfd = -1; pppd_ttyfd = -1;
real_ttyfd = -1; real_ttyfd = -1;
pppd_status = EXIT_OK; pppd_status = EXIT_OK;
++unsuccess; ++unsuccess;
@@ -264,9 +264,9 @@ pppdmain(argc, argv)
/* If the user specified the device name, become the /* If the user specified the device name, become the
user before opening it. */ user before opening it. */
int err; int err;
ttyfd = open(devnam, O_NONBLOCK | O_RDWR, 0); pppd_ttyfd = open(devnam, O_NONBLOCK | O_RDWR, 0);
err = errno; err = errno;
if (ttyfd >= 0) { if (pppd_ttyfd >= 0) {
break; break;
} }
errno = err; errno = err;
@@ -277,8 +277,8 @@ pppdmain(argc, argv)
if (!persist || err != EINTR) if (!persist || err != EINTR)
goto fail; goto fail;
} }
if ((fdflags = fcntl(ttyfd, F_GETFL)) == -1 if ((fdflags = fcntl(pppd_ttyfd, F_GETFL)) == -1
|| fcntl(ttyfd, F_SETFL, fdflags & ~O_NONBLOCK) < 0) || fcntl(pppd_ttyfd, F_SETFL, fdflags & ~O_NONBLOCK) < 0)
warn("Couldn't reset non-blocking mode on device: %m"); warn("Couldn't reset non-blocking mode on device: %m");
/* /*
@@ -291,9 +291,9 @@ pppdmain(argc, argv)
* successfully to the modem with CLOCAL clear and CD down, * successfully to the modem with CLOCAL clear and CD down,
* we could clear CLOCAL at this point. * we could clear CLOCAL at this point.
*/ */
set_up_tty(ttyfd, ((connector != NULL && connector[0] != 0) set_up_tty(pppd_ttyfd, ((connector != NULL && connector[0] != 0)
|| initializer != NULL)); || initializer != NULL));
real_ttyfd = ttyfd; real_ttyfd = pppd_ttyfd;
} }
/* run connection script */ /* run connection script */
@@ -308,7 +308,7 @@ pppdmain(argc, argv)
} }
if (initializer && initializer[0]) { if (initializer && initializer[0]) {
if (device_script(ttyfd, DIALER_INIT, initializer) < 0) { if (device_script(pppd_ttyfd, DIALER_INIT, initializer) < 0) {
error("Initializer script failed"); error("Initializer script failed");
pppd_status = EXIT_INIT_FAILED; pppd_status = EXIT_INIT_FAILED;
goto fail; goto fail;
@@ -320,7 +320,7 @@ pppdmain(argc, argv)
} }
if (connector && connector[0]) { if (connector && connector[0]) {
if (device_script(ttyfd, DIALER_CONNECT, connector) < 0) { if (device_script(pppd_ttyfd, DIALER_CONNECT, connector) < 0) {
error("Connect script failed"); error("Connect script failed");
pppd_status = EXIT_CONNECT_FAILED; pppd_status = EXIT_CONNECT_FAILED;
goto fail; goto fail;
@@ -360,12 +360,12 @@ pppdmain(argc, argv)
/* run welcome script, if any */ /* run welcome script, if any */
if (welcomer && welcomer[0]) { if (welcomer && welcomer[0]) {
if (device_script(ttyfd, DIALER_WELCOME, welcomer) < 0) if (device_script(pppd_ttyfd, DIALER_WELCOME, welcomer) < 0)
warn("Welcome script failed"); warn("Welcome script failed");
} }
/* set up the serial device as a ppp interface */ /* set up the serial device as a ppp interface */
fd_ppp = establish_ppp(ttyfd); fd_ppp = establish_ppp(pppd_ttyfd);
if (fd_ppp < 0) { if (fd_ppp < 0) {
pppd_status = EXIT_FATAL_ERROR; pppd_status = EXIT_FATAL_ERROR;
goto disconnect; goto disconnect;
@@ -415,7 +415,7 @@ pppdmain(argc, argv)
clean_check(); clean_check();
if (demand) if (demand)
restore_loop(); restore_loop();
disestablish_ppp(ttyfd); disestablish_ppp(pppd_ttyfd);
fd_ppp = -1; fd_ppp = -1;
if (!hungup) if (!hungup)
lcp_lowerdown(0); lcp_lowerdown(0);
@@ -429,7 +429,7 @@ pppdmain(argc, argv)
new_phase(PHASE_DISCONNECT); new_phase(PHASE_DISCONNECT);
if (real_ttyfd >= 0) if (real_ttyfd >= 0)
set_up_tty(real_ttyfd, 1); set_up_tty(real_ttyfd, 1);
if (device_script(ttyfd, DIALER_DISCONNECT, disconnect_script) < 0) { if (device_script(pppd_ttyfd, DIALER_DISCONNECT, disconnect_script) < 0) {
warn("disconnect script failed"); warn("disconnect script failed");
} else { } else {
info("Serial link disconnected."); info("Serial link disconnected.");
@@ -685,7 +685,7 @@ cleanup()
sys_cleanup(); sys_cleanup();
if (fd_ppp >= 0) if (fd_ppp >= 0)
disestablish_ppp(ttyfd); disestablish_ppp(pppd_ttyfd);
if (real_ttyfd >= 0) if (real_ttyfd >= 0)
close_tty(); close_tty();

View File

@@ -488,7 +488,7 @@ output(unit, p, len)
dbglog("sent %P", p, len); dbglog("sent %P", p, len);
/* printf("sent packet [%d]\n", len); */ /* printf("sent packet [%d]\n", len); */
if (write(ttyfd, p, len) < 0) { if (write(pppd_ttyfd, p, len) < 0) {
if (errno != EIO) if (errno != EIO)
error("write: %m"); error("write: %m");
} }
@@ -531,7 +531,7 @@ read_packet(buf)
{ {
int len; int len;
if ((len = read(ttyfd, buf, PPP_MTU + PPP_HDRLEN)) < 0) { if ((len = read(pppd_ttyfd, buf, PPP_MTU + PPP_HDRLEN)) < 0) {
if (errno == EWOULDBLOCK || errno == EINTR) len = -1; if (errno == EWOULDBLOCK || errno == EINTR) len = -1;
/*fatal("read: %m"); */ /*fatal("read: %m"); */
} }
@@ -649,7 +649,7 @@ ccp_test(unit, opt_ptr, opt_len, for_transmit)
data.ptr = opt_ptr; data.ptr = opt_ptr;
data.length = opt_len; data.length = opt_len;
data.transmit = for_transmit; data.transmit = for_transmit;
if (ioctl(ttyfd, PPPIOCSCOMPRESS, (caddr_t) &data) >= 0) if (ioctl(pppd_ttyfd, PPPIOCSCOMPRESS, (caddr_t) &data) >= 0)
return 1; return 1;
return (errno == ENOBUFS)? 0: -1; return (errno == ENOBUFS)? 0: -1;
} }

View File

@@ -468,13 +468,14 @@ pr_log __V((void *arg, char *fmt, ...))
* printer. * printer.
*/ */
void void
print_string(p, len, printer, arg) print_string(p_arg, len, printer, arg)
char *p; void *p_arg;
int len; int len;
void (*printer) __P((void *, char *, ...)); void (*printer) __P((void *, char *, ...));
void *arg; void *arg;
{ {
int c; int c;
unsigned char *p = (unsigned char *)p_arg;
printer(arg, "\""); printer(arg, "\"");
for (; len > 0; --len) { for (; len > 0; --len) {