chat.c (85991) | chat.c (93418) |
---|---|
1/*- 2 * Copyright (c) 1998 Brian Somers <brian@Awfulhak.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 1998 Brian Somers <brian@Awfulhak.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/usr.sbin/ppp/chat.c 85991 2001-11-03 21:45:32Z brian $ | 26 * $FreeBSD: head/usr.sbin/ppp/chat.c 93418 2002-03-30 12:30:09Z brian $ |
27 */ 28 29#include <sys/param.h> 30#include <netinet/in.h> 31#include <netinet/in_systm.h> 32#include <netinet/ip.h> 33#include <sys/socket.h> 34#include <sys/un.h> --- 476 unchanged lines hidden (view full) --- 511 */ 512 /* There's always room for the HDLC header */ 513 c->argptr -= 2; 514 c->arglen += 2; 515 memcpy(c->argptr, "\377\003", 2); /* Prepend HDLC header */ 516 } 517 518 wrote = physical_Write(c->physical, c->argptr, c->arglen); | 27 */ 28 29#include <sys/param.h> 30#include <netinet/in.h> 31#include <netinet/in_systm.h> 32#include <netinet/ip.h> 33#include <sys/socket.h> 34#include <sys/un.h> --- 476 unchanged lines hidden (view full) --- 511 */ 512 /* There's always room for the HDLC header */ 513 c->argptr -= 2; 514 c->arglen += 2; 515 memcpy(c->argptr, "\377\003", 2); /* Prepend HDLC header */ 516 } 517 518 wrote = physical_Write(c->physical, c->argptr, c->arglen); |
519 result = wrote ? 1 : 0; | 519 result = wrote > 0 ? 1 : 0; |
520 if (wrote == -1) { | 520 if (wrote == -1) { |
521 if (errno != EINTR) 522 log_Printf(LogERROR, "chat_Write: %s\n", strerror(errno)); | 521 if (errno != EINTR) { 522 log_Printf(LogWARN, "chat_Write: %s\n", strerror(errno)); 523 result = -1; 524 } |
523 if (physical_IsSync(c->physical)) { 524 c->argptr += 2; 525 c->arglen -= 2; 526 } 527 } else if (wrote < 2 && physical_IsSync(c->physical)) { 528 /* Oops - didn't even write our HDLC header ! */ 529 c->argptr += 2; 530 c->arglen -= 2; --- 263 unchanged lines hidden --- | 525 if (physical_IsSync(c->physical)) { 526 c->argptr += 2; 527 c->arglen -= 2; 528 } 529 } else if (wrote < 2 && physical_IsSync(c->physical)) { 530 /* Oops - didn't even write our HDLC header ! */ 531 c->argptr += 2; 532 c->arglen -= 2; --- 263 unchanged lines hidden --- |