Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/sup/source pass lint
details: https://anonhg.NetBSD.org/src/rev/6b5a6b86a715
branches: trunk
changeset: 748228:6b5a6b86a715
user: christos <christos%NetBSD.org@localhost>
date: Sat Oct 17 22:26:13 2009 +0000
description:
pass lint
diffstat:
usr.sbin/sup/source/expand.c | 6 +-
usr.sbin/sup/source/ffilecopy.c | 4 +-
usr.sbin/sup/source/filecopy.c | 8 +-
usr.sbin/sup/source/netcryptvoid.c | 5 +-
usr.sbin/sup/source/scm.c | 28 ++++++------
usr.sbin/sup/source/scmio.c | 85 +++++++++++++++++++------------------
usr.sbin/sup/source/stree.c | 3 +-
usr.sbin/sup/source/supextern.h | 6 +-
usr.sbin/sup/source/supmsg.c | 7 ++-
9 files changed, 82 insertions(+), 70 deletions(-)
diffs (truncated from 605 to 300 lines):
diff -r fbeba45c0482 -r 6b5a6b86a715 usr.sbin/sup/source/expand.c
--- a/usr.sbin/sup/source/expand.c Sat Oct 17 22:20:56 2009 +0000
+++ b/usr.sbin/sup/source/expand.c Sat Oct 17 22:26:13 2009 +0000
@@ -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 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 @@
}
static int
-gethdir(char *home, int homelen)
+gethdir(char *home, size_t homelen)
{
struct passwd *pp = getpwnam(home);
diff -r fbeba45c0482 -r 6b5a6b86a715 usr.sbin/sup/source/ffilecopy.c
--- a/usr.sbin/sup/source/ffilecopy.c Sat Oct 17 22:20:56 2009 +0000
+++ b/usr.sbin/sup/source/ffilecopy.c Sat Oct 17 22:26:13 2009 +0000
@@ -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; \
diff -r fbeba45c0482 -r 6b5a6b86a715 usr.sbin/sup/source/filecopy.c
--- a/usr.sbin/sup/source/filecopy.c Sat Oct 17 22:20:56 2009 +0000
+++ b/usr.sbin/sup/source/filecopy.c Sat Oct 17 22:26:13 2009 +0000
@@ -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);
}
diff -r fbeba45c0482 -r 6b5a6b86a715 usr.sbin/sup/source/netcryptvoid.c
--- a/usr.sbin/sup/source/netcryptvoid.c Sat Oct 17 22:20:56 2009 +0000
+++ b/usr.sbin/sup/source/netcryptvoid.c Sat Oct 17 22:26:13 2009 +0000
@@ -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 @@
}
int
+/*ARGSUSED*/
getcryptbuf(int x __unused)
{
if (cryptflag == 0) {
@@ -77,12 +78,14 @@
}
void
+/*ARGSUSED*/
decode(char *in __unused, char *out __unused, int count __unused)
{
}
void
+/*ARGSUSED*/
encode(char *in __unused, char *out __unused, int count __unused)
{
}
diff -r fbeba45c0482 -r 6b5a6b86a715 usr.sbin/sup/source/scm.c
--- a/usr.sbin/sup/source/scm.c Sat Oct 17 22:20:56 2009 +0000
+++ b/usr.sbin/sup/source/scm.c Sat Oct 17 22:26:13 2009 +0000
@@ -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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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
diff -r fbeba45c0482 -r 6b5a6b86a715 usr.sbin/sup/source/scmio.c
--- a/usr.sbin/sup/source/scmio.c Sat Oct 17 22:20:56 2009 +0000
+++ b/usr.sbin/sup/source/scmio.c Sat Oct 17 22:26:13 2009 +0000
@@ -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 @@
} 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
-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 @@
}
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 @@
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 @@
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;
Home |
Main Index |
Thread Index |
Old Index