Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/lib/libc/gen/getcap.c,v rcsdiff: /ftp/cvs/cvsroot/src/lib/libc/gen/getcap.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.47.10.1 retrieving revision 1.50.2.1 diff -u -p -r1.47.10.1 -r1.50.2.1 --- src/lib/libc/gen/getcap.c 2008/03/23 00:40:25 1.47.10.1 +++ src/lib/libc/gen/getcap.c 2012/04/17 00:05:18 1.50.2.1 @@ -1,4 +1,4 @@ -/* getcap.c,v 1.47 2006/07/04 03:53:54 jnemeth Exp */ +/* $NetBSD: getcap.c,v 1.50.2.1 2012/04/17 00:05:18 yamt Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)getcap.c 8.3 (Berkeley) 3/25/94"; #else -__RCSID("getcap.c,v 1.47 2006/07/04 03:53:54 jnemeth Exp"); +__RCSID("$NetBSD: getcap.c,v 1.50.2.1 2012/04/17 00:05:18 yamt Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -52,6 +52,7 @@ __RCSID("getcap.c,v 1.47 2006/07/04 03:5 #include #include +#include #include #ifndef SMALL #include @@ -64,7 +65,7 @@ __RCSID("getcap.c,v 1.47 2006/07/04 03:5 #include #include -#ifdef __weak_alias +#if defined(__weak_alias) && !defined(SMALL) __weak_alias(cgetcap,_cgetcap) __weak_alias(cgetclose,_cgetclose) __weak_alias(cgetent,_cgetent) @@ -393,7 +394,7 @@ getent(char **cap, size_t *len, const ch rp = record; for (;;) { if (bp >= b_end) { - int n; + ssize_t n; n = read(fd, buf, sizeof(buf)); if (n <= 0) { @@ -456,7 +457,7 @@ getent(char **cap, size_t *len, const ch * some more. */ if (rp >= r_end) { - u_int pos; + ptrdiff_t pos; size_t newsize; pos = rp - record; @@ -518,7 +519,8 @@ tc_exp: if (expandtc) { char *newicap, *s; size_t ilen, newilen; - int diff, iret, tclen; + int iret; + ptrdiff_t diff, tclen; char *icap, *scan, *tc, *tcstart, *tcend; /* @@ -597,7 +599,7 @@ tc_exp: */ diff = newilen - tclen; if (diff >= r_end - rp) { - u_int pos, tcpos, tcposend; + ptrdiff_t pos, tcpos, tcposend; size_t newsize; pos = rp - record; @@ -789,7 +791,7 @@ cgetnext(char **bp, const char * const * if (dbp == NULL) dbp = db_array; - if (pfp == NULL && (pfp = fopen(*dbp, "r")) == NULL) { + if (pfp == NULL && (pfp = fopen(*dbp, "re")) == NULL) { (void)cgetclose(); return -1; } @@ -812,7 +814,7 @@ cgetnext(char **bp, const char * const * (void)cgetclose(); return 0; } else if ((pfp = - fopen(*dbp, "r")) == NULL) { + fopen(*dbp, "re")) == NULL) { (void)cgetclose(); return -1; } else @@ -917,7 +919,7 @@ cgetstr(char *buf, const char *cap, char u_int m_room; const char *bp; char *mp; - int len; + ptrdiff_t len; char *mem, *newmem; _DIAGASSERT(buf != NULL); @@ -1033,7 +1035,8 @@ cgetstr(char *buf, const char *cap, char mem = newmem; } *str = mem; - return len; + _DIAGASSERT(__type_fit(int, len)); + return (int)len; } /* @@ -1052,7 +1055,7 @@ cgetustr(char *buf, const char *cap, cha u_int m_room; const char *bp; char *mp; - int len; + size_t len; char *mem, *newmem; _DIAGASSERT(buf != NULL); @@ -1117,7 +1120,8 @@ cgetustr(char *buf, const char *cap, cha mem = newmem; } *str = mem; - return len; + _DIAGASSERT(__type_fit(int, len)); + return (int)len; } /*