Mon Mar 16 02:18:39 2009 UTC ()
fix sign-compare issue


(lukem)
diff -r1.38 -r1.39 src/libexec/rlogind/rlogind.c

cvs diff -r1.38 -r1.39 src/libexec/rlogind/rlogind.c (expand / switch to unified diff)

--- src/libexec/rlogind/rlogind.c 2008/07/20 01:09:07 1.38
+++ src/libexec/rlogind/rlogind.c 2009/03/16 02:18:39 1.39
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: rlogind.c,v 1.38 2008/07/20 01:09:07 lukem Exp $ */ 1/* $NetBSD: rlogind.c,v 1.39 2009/03/16 02:18:39 lukem Exp $ */
2 2
3/* 3/*
4 * Copyright (C) 1998 WIDE Project. 4 * Copyright (C) 1998 WIDE Project.
5 * All rights reserved. 5 * All rights reserved.
6 *  6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -59,27 +59,27 @@ @@ -59,27 +59,27 @@
59 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 59 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
60 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 60 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
61 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 61 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
62 * SUCH DAMAGE. 62 * SUCH DAMAGE.
63 */ 63 */
64 64
65#include <sys/cdefs.h> 65#include <sys/cdefs.h>
66#ifndef lint 66#ifndef lint
67__COPYRIGHT("@(#) Copyright (c) 1983, 1988, 1989, 1993\ 67__COPYRIGHT("@(#) Copyright (c) 1983, 1988, 1989, 1993\
68 The Regents of the University of California. All rights reserved."); 68 The Regents of the University of California. All rights reserved.");
69#if 0 69#if 0
70static char sccsid[] = "@(#)rlogind.c 8.2 (Berkeley) 4/28/95"; 70static char sccsid[] = "@(#)rlogind.c 8.2 (Berkeley) 4/28/95";
71#else 71#else
72__RCSID("$NetBSD: rlogind.c,v 1.38 2008/07/20 01:09:07 lukem Exp $"); 72__RCSID("$NetBSD: rlogind.c,v 1.39 2009/03/16 02:18:39 lukem Exp $");
73#endif 73#endif
74#endif /* not lint */ 74#endif /* not lint */
75 75
76/* 76/*
77 * remote login server: 77 * remote login server:
78 * \0 78 * \0
79 * remuser\0 79 * remuser\0
80 * locuser\0 80 * locuser\0
81 * terminal_type/speed\0 81 * terminal_type/speed\0
82 * data 82 * data
83 */ 83 */
84 84
85#include <sys/param.h> 85#include <sys/param.h>
@@ -427,27 +427,27 @@ char oobdata[] = {TIOCPKT_WINDOW}; @@ -427,27 +427,27 @@ char oobdata[] = {TIOCPKT_WINDOW};
427/* 427/*
428 * Handle a "control" request (signaled by magic being present) 428 * Handle a "control" request (signaled by magic being present)
429 * in the data stream. For now, we are only willing to handle 429 * in the data stream. For now, we are only willing to handle
430 * window size changes. 430 * window size changes.
431 */ 431 */
432int 432int
433control(pty, cp, n) 433control(pty, cp, n)
434 int pty; 434 int pty;
435 char *cp; 435 char *cp;
436 int n; 436 int n;
437{ 437{
438 struct winsize w; 438 struct winsize w;
439 439
440 if (n < 4+sizeof (w) || cp[2] != 's' || cp[3] != 's') 440 if (n < (int)(4+sizeof (w)) || cp[2] != 's' || cp[3] != 's')
441 return (0); 441 return (0);
442 oobdata[0] &= ~TIOCPKT_WINDOW; /* we know he heard */ 442 oobdata[0] &= ~TIOCPKT_WINDOW; /* we know he heard */
443 memmove(&w, cp+4, sizeof(w)); 443 memmove(&w, cp+4, sizeof(w));
444 w.ws_row = ntohs(w.ws_row); 444 w.ws_row = ntohs(w.ws_row);
445 w.ws_col = ntohs(w.ws_col); 445 w.ws_col = ntohs(w.ws_col);
446 w.ws_xpixel = ntohs(w.ws_xpixel); 446 w.ws_xpixel = ntohs(w.ws_xpixel);
447 w.ws_ypixel = ntohs(w.ws_ypixel); 447 w.ws_ypixel = ntohs(w.ws_ypixel);
448 (void)ioctl(pty, TIOCSWINSZ, &w); 448 (void)ioctl(pty, TIOCSWINSZ, &w);
449 return (4+sizeof (w)); 449 return (4+sizeof (w));
450} 450}
451 451
452/* 452/*
453 * rlogin "protocol" machine. 453 * rlogin "protocol" machine.