pass lint

This commit is contained in:
christos 2009-10-17 22:26:13 +00:00
parent 6a42e0741e
commit 5a6c88acad
9 changed files with 82 additions and 70 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: expand.c,v 1.17 2009/10/13 12:11:19 christos Exp $ */
/* $NetBSD: expand.c,v 1.18 2009/10/17 22:26:13 christos Exp $ */
/*
* Copyright (c) 1991 Carnegie Mellon University
@ -97,7 +97,7 @@ static int match(char *, char *);
static int amatch(char *, char *);
static void addone(char *, const char *);
static int addpath(char);
static int gethdir(char *, int);
static int gethdir(char *, size_t);
int
expand(char *spec, char **buffer, int bufsize)
@ -392,7 +392,7 @@ addpath(char c)
}
static int
gethdir(char *home, int homelen)
gethdir(char *home, size_t homelen)
{
struct passwd *pp = getpwnam(home);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ffilecopy.c,v 1.9 2008/05/30 14:19:57 christos Exp $ */
/* $NetBSD: ffilecopy.c,v 1.10 2009/10/17 22:26:13 christos Exp $ */
/*
* Copyright (c) 1991 Carnegie Mellon University
@ -44,7 +44,7 @@
# define FBUF_HACK(here,there) \
do { \
if ((here)->_r > 0) { \
i = write(therefile, (here)->_p, (here)->_r); \
i = write(therefile, (here)->_p, (size_t)(here)->_r); \
if (i != (here)->_r) \
return EOF; \
(here)->_p = (here)->_bf._base; \

View File

@ -1,4 +1,4 @@
/* $NetBSD: filecopy.c,v 1.4 2002/07/10 20:19:39 wiz Exp $ */
/* $NetBSD: filecopy.c,v 1.5 2009/10/17 22:26:13 christos Exp $ */
/*
* Copyright (c) 1991 Carnegie Mellon University
@ -57,13 +57,13 @@
#include "supcdefs.h"
#include "supextern.h"
int
ssize_t
filecopy(int here, int there)
{
int kount;
ssize_t kount;
char buffer[BUFFERSIZE];
kount = 0;
while (kount == 0 && (kount = read(here, buffer, BUFFERSIZE)) > 0)
kount -= write(there, buffer, kount);
kount -= write(there, buffer, (size_t)kount);
return (kount ? -1 : 0);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: netcryptvoid.c,v 1.9 2006/12/20 16:33:34 christos Exp $ */
/* $NetBSD: netcryptvoid.c,v 1.10 2009/10/17 22:26:13 christos Exp $ */
/*
* Copyright (c) 1992 Carnegie Mellon University
@ -68,6 +68,7 @@ netcrypt(char *pword)
}
int
/*ARGSUSED*/
getcryptbuf(int x __unused)
{
if (cryptflag == 0) {
@ -77,12 +78,14 @@ getcryptbuf(int x __unused)
}
void
/*ARGSUSED*/
decode(char *in __unused, char *out __unused, int count __unused)
{
}
void
/*ARGSUSED*/
encode(char *in __unused, char *out __unused, int count __unused)
{
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: scm.c,v 1.27 2009/10/16 12:41:37 christos Exp $ */
/* $NetBSD: scm.c,v 1.28 2009/10/17 22:26:13 christos Exp $ */
/*
* Copyright (c) 1992 Carnegie Mellon University
@ -263,7 +263,7 @@ servicesetup(char *server, int af)
continue;
}
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
(char *) &one, sizeof(int)) < 0) {
&one, sizeof(int)) < 0) {
cause = "setsockopt(SO_REUSEADDR)";
close(sock);
continue;
@ -296,7 +296,7 @@ service(void)
remotename = NULL;
len = sizeof(from);
do {
netfile = accept(sock, (struct sockaddr *) & from, &len);
netfile = accept(sock, (struct sockaddr *)(void *)&from, &len);
} while (netfile < 0 && errno == EINTR);
if (netfile < 0)
return (scmerr(errno, "Can't accept connections"));
@ -305,7 +305,7 @@ service(void)
return (scmerr(errno, "Can't accept connections"));
}
memcpy(&remoteaddr, &from, len);
if (read(netfile, (char *) &x, sizeof(int)) != sizeof(int))
if (read(netfile, &x, sizeof(int)) != sizeof(int))
return (scmerr(errno, "Can't transmit data on connection"));
if (x == 0x01020304)
swapmode = 0;
@ -369,7 +369,7 @@ dobackoff(int *t, int *b)
return (0);
s = *b * 30;
if (gettimeofday(&tt, (struct timezone *) NULL) >= 0)
s += (tt.tv_usec >> 8) % s;
s += ((uint32_t)tt.tv_usec >> 8) % s;
if (*b < 32)
*b <<= 1;
if (*t != -1) {
@ -411,7 +411,7 @@ request(char *server, char *hostname, int *retry)
gai_strerror(error)));
}
backoff = 1;
while (1) {
for (;;) {
netfile = -1;
for (res = res0; res; res = res->ai_next) {
if (res->ai_addrlen > sizeof(remoteaddr))
@ -445,7 +445,7 @@ request(char *server, char *hostname, int *retry)
memcpy(&remoteaddr, res->ai_addr, res->ai_addrlen);
remotename = estrdup(hostname);
x = 0x01020304;
(void) write(netfile, (char *) &x, sizeof(int));
(void) write(netfile, &x, sizeof(int));
swapmode = 0; /* swap only on server, not client */
freeaddrinfo(res0);
return (SCMOK);
@ -492,9 +492,9 @@ remotehost(void)
char h1[NI_MAXHOST];
if (remotename == NULL) {
if (getnameinfo((struct sockaddr *) & remoteaddr,
if (getnameinfo((struct sockaddr *)(void *)&remoteaddr,
#ifdef BSD4_4
remoteaddr.ss_len,
(socklen_t)remoteaddr.ss_len,
#else
sizeof(struct sockaddr),
#endif
@ -586,9 +586,9 @@ samehost(void)
char h1[NI_MAXHOST], h2[NI_MAXHOST];
const int niflags = NI_NUMERICHOST;
if (getnameinfo((struct sockaddr *) &remoteaddr,
if (getnameinfo((struct sockaddr *)(void *)&remoteaddr,
#ifdef BSD4_4
remoteaddr.ss_len,
(socklen_t)remoteaddr.ss_len,
#else
sizeof(struct sockaddr),
#endif
@ -601,7 +601,7 @@ samehost(void)
continue;
if (getnameinfo(ifa->ifa_addr,
#ifdef BSD4_4
ifa->ifa_addr->sa_len,
(socklen_t)ifa->ifa_addr->sa_len,
#else
sizeof(struct sockaddr),
#endif
@ -623,9 +623,9 @@ matchhost(char *name)
const int niflags = NI_NUMERICHOST;
struct addrinfo hints, *res0, *res;
if (getnameinfo((struct sockaddr *) & remoteaddr,
if (getnameinfo((struct sockaddr *)(void *)&remoteaddr,
#ifdef BSD4_4
remoteaddr.ss_len,
(socklen_t)remoteaddr.ss_len,
#else
sizeof(struct sockaddr),
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: scmio.c,v 1.17 2009/10/16 12:41:37 christos Exp $ */
/* $NetBSD: scmio.c,v 1.18 2009/10/17 22:26:13 christos Exp $ */
/*
* Copyright (c) 1992 Carnegie Mellon University
@ -157,6 +157,7 @@
#include "libc.h"
#include <errno.h>
#include <stdbool.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/file.h>
@ -201,9 +202,9 @@ struct buf {
} buffers[2];
struct buf *gblbufptr; /* buffer pointer */
static int writedata(int, char *);
static int writeblock(int, char *);
static int readdata(int, char *);
static int writedata(size_t, void *);
static int writeblock(size_t, void *);
static int readdata(size_t, void *, bool);
static int readcount(int *);
@ -212,7 +213,7 @@ static int readcount(int *);
***********************************************/
static int
writedata(int count, char *data)
writedata(size_t count, void *data)
{ /* write raw data to network */
int x, tries;
struct buf *bp;
@ -260,12 +261,12 @@ writedata(int count, char *data)
}
static int
writeblock(int count, char *data)
writeblock(size_t count, void *data)
{ /* write data block */
int x;
int y = byteswap(count);
int y = byteswap((int)count);
x = writedata(sizeof(int), (char *) &y);
x = writedata(sizeof(int), &y);
if (x == SCMOK)
x = writedata(count, data);
return (x);
@ -284,18 +285,18 @@ writemsg(int msg)
gblbufptr->b_ptr = gblbufptr->b_data;
gblbufptr->b_cnt = 0;
x = byteswap(msg);
return (writedata(sizeof(int), (char *) &x));
return (writedata(sizeof(int), &x));
}
int
writemend(void)
{ /* write end of message */
int count;
size_t count;
char *data;
int x;
x = byteswap(ENDCOUNT);
x = writedata(sizeof(int), (char *) &x);
x = writedata(sizeof(int), &x);
if (x != SCMOK)
return (x);
if (gblbufptr == NULL)
@ -317,18 +318,19 @@ writeint(int i)
if (scmdebug > 2)
loginfo("SCM Writing integer %d", i);
x = byteswap(i);
return (writeblock(sizeof(int), (char *) &x));
return (writeblock(sizeof(int), &x));
}
int
writestring(char *p)
{ /* write string as data block */
int len, x;
int len;
int x;
if (p == NULL) {
int y = byteswap(NULLCOUNT);
if (scmdebug > 2)
loginfo("SCM Writing string NULL");
return (writedata(sizeof(int), (char *) &y));
return (writedata(sizeof(int), &y));
}
if (scmdebug > 2)
loginfo("SCM Writing string %s", p);
@ -340,7 +342,7 @@ writestring(char *p)
encode(p, cryptbuf, len);
p = cryptbuf;
}
return (writeblock(len, p));
return (writeblock((size_t)len, p));
}
int
@ -353,9 +355,9 @@ writefile(int f)
if (fstat(f, &statbuf) < 0)
return (scmerr(errno, "Can't access open file for message"));
filesize = statbuf.st_size;
filesize = (int)statbuf.st_size;
y = byteswap(filesize);
x = writedata(sizeof(int), (char *) &y);
x = writedata(sizeof(int), &y);
if (cryptflag)
x = getcryptbuf(FILEXFER);
@ -367,9 +369,9 @@ writefile(int f)
if (number > 0) {
if (cryptflag) {
encode(buf, cryptbuf, number);
x = writedata(number, cryptbuf);
x = writedata((size_t)number, cryptbuf);
} else {
x = writedata(number, buf);
x = writedata((size_t)number, buf);
}
sum += number;
}
@ -420,7 +422,7 @@ writemstr(int msg, char *p)
*************************************************/
static int
readdata(int count, char *data)
readdata(size_t count, void *vdata, bool push)
{ /* read raw data from network */
char *p;
int c, n, m, x;
@ -428,12 +430,13 @@ readdata(int count, char *data)
static char *bufptr;
static char buffer[FILEXFER];
struct pollfd set[1];
char *data = vdata;
if (count < 0) {
if (push) {
if (bufptr + count < buffer)
return (scmerr(-1, "No space in buffer %d", count));
bufptr += count;
bufcnt -= count;
bufptr -= count;
bufcnt += count;
memcpy(bufptr, data, -count);
return (SCMOK);
}
@ -448,7 +451,7 @@ readdata(int count, char *data)
return (SCMOK);
}
if (bufcnt > 0) {
memcpy(data, bufptr, bufcnt);
memcpy(data, bufptr, (size_t)bufcnt);
data += bufcnt;
count -= bufcnt;
}
@ -466,7 +469,7 @@ readdata(int count, char *data)
if (errno != EINTR)
sleep(5);
}
x = read(netfile, p, n);
x = read(netfile, p, (size_t)n);
if (x == 0)
return (scmerr(-1, "Premature EOF on network input"));
if (x < 0)
@ -476,7 +479,7 @@ readdata(int count, char *data)
m -= x;
bufcnt += x;
}
memcpy(data, bufptr, count);
memcpy(data, bufptr, (size_t)count);
bufptr += count;
bufcnt -= count;
return (SCMOK);
@ -487,7 +490,7 @@ readcount(int *count)
{ /* read count of data block */
int x;
int y;
x = readdata(sizeof(int), (char *) &y);
x = readdata(sizeof(int), &y, false);
if (x != SCMOK)
return (x);
*count = byteswap(y);
@ -499,10 +502,10 @@ prereadcount(int *count)
{ /* preread count of data block */
int x;
int y;
x = readdata(sizeof(int), (char *) &y);
x = readdata(sizeof(int), &y, false);
if (x != SCMOK)
return (x);
x = readdata(-((int) (sizeof(int))), (char *) &y);
x = readdata(sizeof(int), &y, true);
if (x != SCMOK)
return (x);
*count = byteswap(y);
@ -512,7 +515,7 @@ prereadcount(int *count)
int
readflush(void)
{
return (readdata(0, (char *) NULL));
return readdata(0, NULL, false);
}
int
@ -523,7 +526,7 @@ readmsg(int msg)
int m;
if (scmdebug > 1)
loginfo("SCM Reading message %d", msg);
x = readdata(sizeof(int), (char *) &m); /* msg type */
x = readdata(sizeof(int), &m, false); /* msg type */
if (x != SCMOK)
return (x);
m = byteswap(m);
@ -547,7 +550,7 @@ readmend(void)
{
int x;
int y;
x = readdata(sizeof(int), (char *) &y);
x = readdata(sizeof(int), &y, false);
y = byteswap(y);
if (x == SCMOK && y != ENDCOUNT)
return (scmerr(-1, "Error reading end of message"));
@ -566,7 +569,7 @@ readskip(void)
if (n < 0)
return (scmerr(-1, "Invalid message count %d", n));
while (x == SCMOK && n > 0) {
x = readdata(XFERSIZE(n), buf);
x = readdata((size_t)XFERSIZE(n), buf, false);
n -= XFERSIZE(n);
}
return (x);
@ -584,7 +587,7 @@ readint(int *buf)
return (scmerr(-1, "Invalid message count %d", y));
if (y != sizeof(int))
return (scmerr(-1, "Size error for int message is %d", y));
x = readdata(sizeof(int), (char *) &y);
x = readdata(sizeof(int), &y, false);
(*buf) = byteswap(y);
if (scmdebug > 2)
loginfo("SCM Reading integer %d", *buf);
@ -616,7 +619,7 @@ readstring(char **buf)
if (cryptflag) {
x = getcryptbuf(count + 1);
if (x == SCMOK)
x = readdata(count, cryptbuf);
x = readdata((size_t)count, cryptbuf, false);
if (x != SCMOK) {
free(p);
return (x);
@ -625,7 +628,7 @@ readstring(char **buf)
printf("SCM Reading encrypted string %s\n", cryptbuf);
decode(cryptbuf, p, count);
} else {
x = readdata(count, p);
x = readdata((size_t)count, p, false);
if (x != SCMOK) {
free(p);
return (x);
@ -657,13 +660,13 @@ readfile(int f)
return (scmerr(-1, "Invalid message count %d", count));
while (x == SCMOK && count > 0) {
if (cryptflag) {
x = readdata(XFERSIZE(count), cryptbuf);
x = readdata((size_t)XFERSIZE(count), cryptbuf, false);
if (x == SCMOK)
decode(cryptbuf, buf, XFERSIZE(count));
} else
x = readdata(XFERSIZE(count), buf);
x = readdata((size_t)XFERSIZE(count), buf, false);
if (x == SCMOK) {
(void) write(f, buf, XFERSIZE(count));
(void) write(f, buf, (size_t)XFERSIZE(count));
count -= XFERSIZE(count);
}
}
@ -736,7 +739,7 @@ crosspatch(void)
if (c <= 0) {
break;
}
(void) write(1, buf, c);
(void) write(1, buf, (size_t)c);
}
}
if (set[0].revents & POLLIN) {
@ -746,7 +749,7 @@ crosspatch(void)
else {
if (c <= 0)
break;
(void) write(netfile, buf, c);
(void) write(netfile, buf, (size_t)c);
}
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: stree.c,v 1.14 2009/10/17 20:46:03 christos Exp $ */
/* $NetBSD: stree.c,v 1.15 2009/10/17 22:26:13 christos Exp $ */
/*
* Copyright (c) 1992 Carnegie Mellon University
@ -338,6 +338,7 @@ Tprocess(TREE * t, int (*f) (TREE *, void *), void *args)
}
static int
/*ARGSUSED*/
Tprintone(TREE * t, void *v __unused)
{
int i;

View File

@ -1,4 +1,4 @@
/* $NetBSD: supextern.h,v 1.21 2009/10/16 12:41:37 christos Exp $ */
/* $NetBSD: supextern.h,v 1.22 2009/10/17 22:26:13 christos Exp $ */
struct stat;
@ -9,10 +9,10 @@ unsigned int atoo(char *);
int expand(char *, char **, int);
/* ffilecopy.c */
int ffilecopy(FILE *, FILE *);
ssize_t ffilecopy(FILE *, FILE *);
/* filecopy.c */
int filecopy(int, int );
ssize_t filecopy(int, int );
/* log.c */
void logopen(char *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: supmsg.c,v 1.16 2009/10/16 12:41:37 christos Exp $ */
/* $NetBSD: supmsg.c,v 1.17 2009/10/17 22:26:13 christos Exp $ */
/*
* Copyright (c) 1992 Carnegie Mellon University
@ -323,6 +323,7 @@ msglogack(void)
extern TREE *refuseT; /* tree of files to refuse */
static int
/*ARGSUSED*/
refuseone(TREE * t, void *v __unused)
{
return (writestring(t->Tname));
@ -365,6 +366,7 @@ extern TREE *listT; /* tree of files to list */
extern time_t scantime; /* time that collection was scanned */
static int
/*ARGSUSED*/
listone(TREE * t, void *v __unused)
{
int x;
@ -430,6 +432,7 @@ msglist(void)
extern TREE *needT; /* tree of files to need */
static int
/*ARGSUSED*/
needone(TREE * t, void *v __unused)
{
int x;
@ -481,6 +484,7 @@ msgneed(void)
extern TREE *denyT; /* tree of files to deny */
static int
/*ARGSUSED*/
denyone(TREE * t, void *v __unused)
{
return (writestring(t->Tname));
@ -532,6 +536,7 @@ msgsend(void)
extern TREE *upgradeT; /* pointer to file being upgraded */
static int
/*ARGSUSED*/
writeone(TREE * t, void *v __unused)
{
return (writestring(t->Tname));