Module Name: src
Committed By: christos
Date: Wed Sep 25 16:53:58 UTC 2024
Modified Files:
src/usr.bin/ftp: cmds.c complete.c fetch.c ftp.c main.c progressbar.c
ssl.c util.c
Log Message:
pass some lint.
To generate a diff of this commit:
cvs rdiff -u -r1.142 -r1.143 src/usr.bin/ftp/cmds.c
cvs rdiff -u -r1.47 -r1.48 src/usr.bin/ftp/complete.c
cvs rdiff -u -r1.239 -r1.240 src/usr.bin/ftp/fetch.c
cvs rdiff -u -r1.176 -r1.177 src/usr.bin/ftp/ftp.c
cvs rdiff -u -r1.130 -r1.131 src/usr.bin/ftp/main.c
cvs rdiff -u -r1.25 -r1.26 src/usr.bin/ftp/progressbar.c
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/ftp/ssl.c
cvs rdiff -u -r1.167 -r1.168 src/usr.bin/ftp/util.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/ftp/cmds.c
diff -u src/usr.bin/ftp/cmds.c:1.142 src/usr.bin/ftp/cmds.c:1.143
--- src/usr.bin/ftp/cmds.c:1.142 Thu Jul 18 23:53:13 2024
+++ src/usr.bin/ftp/cmds.c Wed Sep 25 12:53:58 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: cmds.c,v 1.142 2024/07/19 03:53:13 lukem Exp $ */
+/* $NetBSD: cmds.c,v 1.143 2024/09/25 16:53:58 christos Exp $ */
/*-
* Copyright (c) 1996-2021 The NetBSD Foundation, Inc.
@@ -96,7 +96,7 @@
#if 0
static char sccsid[] = "@(#)cmds.c 8.6 (Berkeley) 10/9/94";
#else
-__RCSID("$NetBSD: cmds.c,v 1.142 2024/07/19 03:53:13 lukem Exp $");
+__RCSID("$NetBSD: cmds.c,v 1.143 2024/09/25 16:53:58 christos Exp $");
#endif
#endif /* not lint */
@@ -172,7 +172,7 @@ confirm(const char *cmd, const char *fil
promptleft = cmd;
promptright = file;
}
- while (1) {
+ for (;;) {
fprintf(ttyout, "%s %s [anpqy?]? ", promptleft, promptright);
(void)fflush(ttyout);
if (get_line(stdin, cline, sizeof(cline), &errormsg) < 0) {
@@ -1830,10 +1830,10 @@ account(int argc, char *argv[])
memset(ap, 0, strlen(ap));
}
-sigjmp_buf abortprox;
+static sigjmp_buf abortprox;
void
-proxabort(int notused)
+proxabort(int notused __unused)
{
sigint_raised = 1;
@@ -1855,7 +1855,7 @@ void
doproxy(int argc, char *argv[])
{
struct cmd *c;
- int cmdpos;
+ size_t cmdpos;
sigfunc oldintr;
char cmdbuf[MAX_C_NAME];
@@ -2038,7 +2038,7 @@ setnmap(int argc, char *argv[])
}
static const char *
-domap(char *dst, size_t dlen, const char *src)
+domap(char *dst, size_t dlen __unused, const char *src)
{
const char *cp1 = src;
char *cp2 = mapin;
@@ -2483,7 +2483,7 @@ macdef(int argc, char *argv[])
}
tmp++;
}
- while (1) {
+ for (;;) {
while ((c = getchar()) != '\n' && c != EOF)
/* LOOP */;
if (c == EOF || getchar() == '\n') {
@@ -2605,7 +2605,8 @@ lpage(int argc, char *argv[])
void
page(int argc, char *argv[])
{
- int ohash, orestart_point, overbose;
+ int ohash, overbose;
+ off_t orestart_point;
size_t len;
const char *p;
char *pager;
@@ -2627,7 +2628,8 @@ page(int argc, char *argv[])
ohash = hash;
orestart_point = restart_point;
overbose = verbose;
- hash = restart_point = verbose = 0;
+ hash = verbose = 0;
+ restart_point = 0;
recvrequest("RETR", pager, argv[1], "r+", 1, 0);
hash = ohash;
restart_point = orestart_point;
Index: src/usr.bin/ftp/complete.c
diff -u src/usr.bin/ftp/complete.c:1.47 src/usr.bin/ftp/complete.c:1.48
--- src/usr.bin/ftp/complete.c:1.47 Mon Jan 28 07:04:16 2019
+++ src/usr.bin/ftp/complete.c Wed Sep 25 12:53:58 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: complete.c,v 1.47 2019/01/28 12:04:16 christos Exp $ */
+/* $NetBSD: complete.c,v 1.48 2024/09/25 16:53:58 christos Exp $ */
/*-
* Copyright (c) 1997-2009 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: complete.c,v 1.47 2019/01/28 12:04:16 christos Exp $");
+__RCSID("$NetBSD: complete.c,v 1.48 2024/09/25 16:53:58 christos Exp $");
#endif /* not lint */
/*
@@ -349,7 +349,7 @@ complete_remote(char *word, int list)
* Generic complete routine
*/
unsigned char
-complete(EditLine *cel, int ch)
+complete(EditLine *cel, int ch __unused)
{
static char word[FTPBUFLEN];
static size_t lastc_argc, lastc_argo;
Index: src/usr.bin/ftp/fetch.c
diff -u src/usr.bin/ftp/fetch.c:1.239 src/usr.bin/ftp/fetch.c:1.240
--- src/usr.bin/ftp/fetch.c:1.239 Sun Feb 18 17:29:56 2024
+++ src/usr.bin/ftp/fetch.c Wed Sep 25 12:53:58 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: fetch.c,v 1.239 2024/02/18 22:29:56 christos Exp $ */
+/* $NetBSD: fetch.c,v 1.240 2024/09/25 16:53:58 christos Exp $ */
/*-
* Copyright (c) 1997-2015 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: fetch.c,v 1.239 2024/02/18 22:29:56 christos Exp $");
+__RCSID("$NetBSD: fetch.c,v 1.240 2024/09/25 16:53:58 christos Exp $");
#endif /* not lint */
/*
@@ -261,8 +261,8 @@ freeurlinfo(struct urlinfo *ui)
static int
auth_url(const char *challenge, char **response, const struct authinfo *auth)
{
- const char *cp, *scheme, *errormsg;
- char *ep, *clear, *realm;
+ const char *cp, *ep, *scheme, *errormsg;
+ char *clear, *realm;
char uuser[BUFSIZ], *gotpass;
const char *upass;
int rval;
@@ -590,7 +590,7 @@ parse_url(const char *url, const char *d
cp, desc, origurl);
goto cleanup_parse_url;
}
- ui->portnum = nport;
+ ui->portnum = (in_port_t)nport;
tport = cp;
} else
tport = get_port(ui);
@@ -614,7 +614,7 @@ parse_url(const char *url, const char *d
return (0);
}
-sigjmp_buf httpabort;
+static sigjmp_buf httpabort;
static int
ftp_socket(const struct urlinfo *ui, void **ssl, struct authinfo *auth)
@@ -1716,7 +1716,7 @@ fetch_url(const char *url, const char *p
lastchunk = 0;
/* read chunk-size */
if (ischunked) {
- if (fetch_getln(xferbuf, bufsize, fin) == NULL) {
+ if (fetch_getln(xferbuf, (int)bufsize, fin) == NULL) {
warnx("Unexpected EOF reading chunk-size");
goto cleanup_fetch_url;
}
@@ -1759,7 +1759,7 @@ fetch_url(const char *url, const char *p
}
}
/* transfer file or chunk */
- while (1) {
+ for (;;) {
struct timeval then, now, td;
volatile off_t bufrem;
@@ -1798,7 +1798,7 @@ fetch_url(const char *url, const char *p
}
}
if (rate_get) {
- while (1) {
+ for (;;) {
(void)gettimeofday(&now, NULL);
timersub(&now, &then, &td);
if (td.tv_sec > 0)
@@ -1812,7 +1812,7 @@ fetch_url(const char *url, const char *p
/* read CRLF after chunk*/
chunkdone:
if (ischunked) {
- if (fetch_getln(xferbuf, bufsize, fin) == NULL) {
+ if (fetch_getln(xferbuf, (int)bufsize, fin) == NULL) {
alarmtimer(0);
warnx("Unexpected EOF reading chunk CRLF");
goto cleanup_fetch_url;
@@ -1896,7 +1896,7 @@ chunkerror:
* Abort a HTTP retrieval
*/
static void
-aborthttp(int notused)
+aborthttp(int notused __unused)
{
char msgbuf[100];
int len;
@@ -1913,7 +1913,7 @@ aborthttp(int notused)
}
static void
-timeouthttp(int notused)
+timeouthttp(int notused __unused)
{
char msgbuf[100];
int len;
@@ -2275,7 +2275,7 @@ static int
go_fetch(const char *url, struct urlinfo *rui)
{
char *proxyenv;
- char *p;
+ const char *p;
#ifndef NO_ABOUT
/*
Index: src/usr.bin/ftp/ftp.c
diff -u src/usr.bin/ftp/ftp.c:1.176 src/usr.bin/ftp/ftp.c:1.177
--- src/usr.bin/ftp/ftp.c:1.176 Sun Feb 18 17:29:56 2024
+++ src/usr.bin/ftp/ftp.c Wed Sep 25 12:53:58 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: ftp.c,v 1.176 2024/02/18 22:29:56 christos Exp $ */
+/* $NetBSD: ftp.c,v 1.177 2024/09/25 16:53:58 christos Exp $ */
/*-
* Copyright (c) 1996-2021 The NetBSD Foundation, Inc.
@@ -92,7 +92,7 @@
#if 0
static char sccsid[] = "@(#)ftp.c 8.6 (Berkeley) 10/27/94";
#else
-__RCSID("$NetBSD: ftp.c,v 1.176 2024/02/18 22:29:56 christos Exp $");
+__RCSID("$NetBSD: ftp.c,v 1.177 2024/09/25 16:53:58 christos Exp $");
#endif
#endif /* not lint */
@@ -123,13 +123,13 @@ __RCSID("$NetBSD: ftp.c,v 1.176 2024/02/
#include "ftp_var.h"
-volatile sig_atomic_t abrtflag;
-volatile sig_atomic_t timeoutflag;
+static volatile sig_atomic_t abrtflag;
+static volatile sig_atomic_t timeoutflag;
-sigjmp_buf ptabort;
-int ptabflg;
-int ptflag = 0;
-char pasv[BUFSIZ]; /* passive port for proxy data connection */
+static sigjmp_buf ptabort;
+static int ptabflg;
+static int ptflag = 0;
+static char pasv[BUFSIZ]; /* passive port for proxy data connection */
size_t ftp_buflen = FTPBUFLEN;
static int empty(FILE *, FILE *, int);
@@ -155,7 +155,7 @@ struct sockinet {
#define su_family si_su.su_sin.sin_family
#define su_port si_su.su_sin.sin_port
-struct sockinet myctladdr, hisctladdr, data_addr;
+static struct sockinet myctladdr, hisctladdr, data_addr;
char *
hookup(const char *host, const char *port)
@@ -241,7 +241,7 @@ hookup(const char *host, const char *por
res0 = res = NULL;
len = hisctladdr.su_len;
- if (getsockname(s, (struct sockaddr *)&myctladdr.si_su, &len) == -1) {
+ if (getsockname(s, (struct sockaddr *)(void *)&myctladdr.si_su, &len) == -1) {
warn("Can't determine my address of connection to `%s:%s'",
host, port);
code = -1;
@@ -298,7 +298,7 @@ hookup(const char *host, const char *por
}
void
-cmdabort(int notused)
+cmdabort(int notused __unused)
{
int oerrno = errno;
@@ -313,7 +313,7 @@ cmdabort(int notused)
}
void
-cmdtimeout(int notused)
+cmdtimeout(int notused __unused)
{
int oerrno = errno;
@@ -569,10 +569,10 @@ empty(FILE *ecin, FILE *din, int sec)
return nr;
}
-sigjmp_buf xferabort;
+static sigjmp_buf xferabort;
__dead static void
-abortxfer(int notused)
+abortxfer(int notused __unused)
{
char msgbuf[100];
size_t len;
@@ -623,7 +623,7 @@ copy_bytes(int infd, int outfd, char *bu
else
bufchunk = bufsize;
- while (1) {
+ for (;;) {
if (rate_limit) {
(void)gettimeofday(&tvthen, NULL);
}
@@ -664,7 +664,7 @@ copy_bytes(int infd, int outfd, char *bu
}
}
if (rate_limit) { /* rate limited; wait if necessary */
- while (1) {
+ for (;;) {
(void)gettimeofday(&tvnow, NULL);
timersub(&tvnow, &tvthen, &tvdiff);
if (tvdiff.tv_sec > 0)
@@ -776,7 +776,7 @@ sendrequest(const char *cmd, const char
if (restart_point &&
(strcmp(cmd, "STOR") == 0 || strcmp(cmd, "APPE") == 0)) {
- int rc;
+ off_t rc;
rc = -1;
switch (curtype) {
@@ -1518,7 +1518,7 @@ initconn(void)
} else
goto bad;
- if (ftp_connect(data, (struct sockaddr *)&data_addr.si_su,
+ if (ftp_connect(data, (struct sockaddr *)(void *)&data_addr.si_su,
data_addr.su_len, 1) < 0) {
if (activefallback) {
(void)close(data);
@@ -1563,7 +1563,7 @@ initconn(void)
warn("Can't set SO_REUSEADDR on data connection");
goto bad;
}
- if (bind(data, (struct sockaddr *)&data_addr.si_su,
+ if (bind(data, (struct sockaddr *)(void *)&data_addr.si_su,
data_addr.su_len) < 0) {
warn("Can't bind for data connection");
goto bad;
@@ -1575,7 +1575,7 @@ initconn(void)
}
len = sizeof(data_addr.si_su);
memset((char *)&data_addr, 0, sizeof (data_addr));
- if (getsockname(data, (struct sockaddr *)&data_addr.si_su, &len) == -1) {
+ if (getsockname(data, (struct sockaddr *)(void *)&data_addr.si_su, &len) == -1) {
warn("Can't determine my address of data connection");
goto bad;
}
@@ -1607,7 +1607,7 @@ initconn(void)
if (tmp.su_family == AF_INET6)
tmp.si_su.su_sin6.sin6_scope_id = 0;
#endif
- if (getnameinfo((struct sockaddr *)&tmp.si_su,
+ if (getnameinfo((struct sockaddr *)(void *)&tmp.si_su,
tmp.su_len, hname, sizeof(hname), sname,
sizeof(sname), NI_NUMERICHOST | NI_NUMERICSERV)) {
result = ERROR;
@@ -1730,7 +1730,7 @@ dataconn(const char *lmode)
do {
(void)gettimeofday(&now, NULL);
timersub(&endtime, &now, &td);
- timeout = td.tv_sec * 1000 + td.tv_usec/1000;
+ timeout = (int)(td.tv_sec * 1000 + td.tv_usec / 1000);
if (timeout < 0)
timeout = 0;
rv = ftp_poll(pfd, 1, timeout);
@@ -1748,7 +1748,7 @@ dataconn(const char *lmode)
/* (non-blocking) accept the connection */
fromlen = myctladdr.su_len;
do {
- s = accept(data, (struct sockaddr *) &from.si_su, &fromlen);
+ s = accept(data, (struct sockaddr *)(void *)&from.si_su, &fromlen);
/* loop until accept !EINTR && !EAGAIN */
} while (s == -1 && (errno == EINTR || errno == EAGAIN));
if (s == -1) {
@@ -1779,7 +1779,7 @@ dataconn(const char *lmode)
}
void
-psabort(int notused)
+psabort(int notused __unused)
{
int oerrno = errno;
@@ -1877,7 +1877,7 @@ pswitch(int flag)
}
__dead static void
-abortpt(int notused)
+abortpt(int notused __unused)
{
sigint_raised = 1;
@@ -2041,7 +2041,8 @@ gunique(const char *local)
{
static char new[MAXPATHLEN];
char *cp = strrchr(local, '/');
- int d, count=0, len;
+ int d, count = 0;
+ size_t len;
char ext = '1';
if (cp)
@@ -2176,7 +2177,7 @@ ai_unmapped(struct addrinfo *ai)
if (ai->ai_addrlen != sizeof(struct sockaddr_in6) ||
sizeof(sin) > ai->ai_addrlen)
return;
- sin6 = (struct sockaddr_in6 *)ai->ai_addr;
+ sin6 = (struct sockaddr_in6 *)(void *)ai->ai_addr;
if (!IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr))
return;
Index: src/usr.bin/ftp/main.c
diff -u src/usr.bin/ftp/main.c:1.130 src/usr.bin/ftp/main.c:1.131
--- src/usr.bin/ftp/main.c:1.130 Sun Feb 18 17:29:56 2024
+++ src/usr.bin/ftp/main.c Wed Sep 25 12:53:58 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.130 2024/02/18 22:29:56 christos Exp $ */
+/* $NetBSD: main.c,v 1.131 2024/09/25 16:53:58 christos Exp $ */
/*-
* Copyright (c) 1996-2023 The NetBSD Foundation, Inc.
@@ -98,7 +98,7 @@ __COPYRIGHT("@(#) Copyright (c) 1985, 19
#if 0
static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 10/9/94";
#else
-__RCSID("$NetBSD: main.c,v 1.130 2024/02/18 22:29:56 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.131 2024/09/25 16:53:58 christos Exp $");
#endif
#endif /* not lint */
@@ -346,13 +346,13 @@ main(int volatile argc, char **volatile
break;
case 'q':
- quit_time = strtol(optarg, &ep, 10);
+ quit_time = (int)strtol(optarg, &ep, 10);
if (quit_time < 1 || *ep != '\0')
errx(1, "Bad quit value: %s", optarg);
break;
case 'r':
- retry_connect = strtol(optarg, &ep, 10);
+ retry_connect = (int)strtol(optarg, &ep, 10);
if (retry_connect < 1 || *ep != '\0')
errx(1, "Bad retry value: %s", optarg);
break;
@@ -765,7 +765,8 @@ getcmd(const char *name)
{
const char *p, *q;
struct cmd *c, *found;
- int nmatches, longest;
+ int nmatches;
+ ptrdiff_t longest;
if (name == NULL)
return (0);
@@ -795,7 +796,7 @@ getcmd(const char *name)
* Slice a string up into argc/argv.
*/
-int slrflag;
+static int slrflag;
void
makeargv(void)
Index: src/usr.bin/ftp/progressbar.c
diff -u src/usr.bin/ftp/progressbar.c:1.25 src/usr.bin/ftp/progressbar.c:1.26
--- src/usr.bin/ftp/progressbar.c:1.25 Thu Jul 18 23:53:13 2024
+++ src/usr.bin/ftp/progressbar.c Wed Sep 25 12:53:58 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: progressbar.c,v 1.25 2024/07/19 03:53:13 lukem Exp $ */
+/* $NetBSD: progressbar.c,v 1.26 2024/09/25 16:53:58 christos Exp $ */
/*-
* Copyright (c) 1997-2024 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: progressbar.c,v 1.25 2024/07/19 03:53:13 lukem Exp $");
+__RCSID("$NetBSD: progressbar.c,v 1.26 2024/09/25 16:53:58 christos Exp $");
#endif /* not lint */
/*
@@ -76,7 +76,7 @@ static void updateprogressmeter(int);
* SIGALRM handler to update the progress meter
*/
static void
-updateprogressmeter(int dummy)
+updateprogressmeter(int dummy __unused)
{
int oerrno = errno;
@@ -376,7 +376,7 @@ ptransfer(int siginfo)
* SIG{INFO,QUIT} handler to print transfer stats if a transfer is in progress
*/
void
-psummary(int notused)
+psummary(int notused __unused)
{
int oerrno = errno;
Index: src/usr.bin/ftp/ssl.c
diff -u src/usr.bin/ftp/ssl.c:1.19 src/usr.bin/ftp/ssl.c:1.20
--- src/usr.bin/ftp/ssl.c:1.19 Thu Jul 18 23:51:21 2024
+++ src/usr.bin/ftp/ssl.c Wed Sep 25 12:53:58 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: ssl.c,v 1.19 2024/07/19 03:51:21 lukem Exp $ */
+/* $NetBSD: ssl.c,v 1.20 2024/09/25 16:53:58 christos Exp $ */
/*-
* Copyright (c) 1998-2004 Dag-Erling Coïdan Smørgrav
@@ -35,7 +35,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: ssl.c,v 1.19 2024/07/19 03:51:21 lukem Exp $");
+__RCSID("$NetBSD: ssl.c,v 1.20 2024/09/25 16:53:58 christos Exp $");
#endif
#include <err.h>
@@ -113,7 +113,8 @@ fetch_writev(struct fetch_connect *conn,
do {
(void)gettimeofday(&now, NULL);
timersub(&timeout, &now, &delta);
- timeout_secs = delta.tv_sec * 1000 + delta.tv_usec/1000;
+ timeout_secs = (int)(delta.tv_sec * 1000
+ + delta.tv_usec / 1000);
if (timeout_secs < 0)
timeout_secs = 0;
rv = ftp_poll(pfd, 1, timeout_secs);
@@ -129,7 +130,7 @@ fetch_writev(struct fetch_connect *conn,
errno = 0;
#ifdef WITH_SSL
if (conn->ssl != NULL)
- len = SSL_write(conn->ssl, iov->iov_base, iov->iov_len);
+ len = SSL_write(conn->ssl, iov->iov_base, (int)iov->iov_len);
else
#endif
len = writev(fd, iov, iovcnt);
@@ -177,7 +178,7 @@ fetch_printf(struct fetch_connect *conn,
va_list ap;
size_t len;
char *msg;
- int r;
+ ssize_t r;
va_start(ap, fmt);
len = vasprintf(&msg, fmt, ap);
@@ -190,7 +191,7 @@ fetch_printf(struct fetch_connect *conn,
r = fetch_write(msg, len, conn);
free(msg);
- return r;
+ return (int)r;
}
int
@@ -301,8 +302,8 @@ fetch_close(struct fetch_connect *conn)
static ssize_t
fetch_ssl_read(SSL *ssl, void *buf, size_t len)
{
- ssize_t rlen;
- rlen = SSL_read(ssl, buf, len);
+ int rlen;
+ rlen = SSL_read(ssl, buf, (int)len);
if (rlen >= 0)
return rlen;
@@ -376,7 +377,8 @@ fetch_wait(struct fetch_connect *conn, s
if (quit_time > 0) {
gettimeofday(&now, NULL);
timersub(timeout, &now, &delta);
- timeout_secs = delta.tv_sec * 1000 + delta.tv_usec/1000;
+ timeout_secs = (int)(delta.tv_sec * 1000
+ + delta.tv_usec / 1000);
if (timeout_secs < 0)
timeout_secs = 0;
} else {
@@ -555,7 +557,7 @@ fetch_getline(struct fetch_connect *conn
size_t len;
int rv;
- if (fetch_getln(buf, buflen, conn) == NULL) {
+ if (fetch_getln(buf, (int)buflen, conn) == NULL) {
if (conn->iseof) { /* EOF */
rv = -2;
if (errormsg)
@@ -572,7 +574,7 @@ fetch_getline(struct fetch_connect *conn
if (buf[len - 1] == '\n') { /* clear any trailing newline */
buf[--len] = '\0';
} else if (len == buflen - 1) { /* line too long */
- while (1) {
+ for (;;) {
char c;
size_t rlen = fetch_read(&c, sizeof(c), 1, conn);
if (rlen == 0 || c == '\n')
@@ -585,7 +587,7 @@ fetch_getline(struct fetch_connect *conn
}
if (errormsg)
*errormsg = NULL;
- return len;
+ return (int)len;
}
#ifdef WITH_SSL
@@ -687,7 +689,8 @@ fetch_start_ssl(int sock, const char *se
}
(void)gettimeofday(&now, NULL);
timersub(&timeout, &now, &delta);
- timeout_secs = delta.tv_sec * 1000 + delta.tv_usec/1000;
+ timeout_secs = (int)(delta.tv_sec * 1000
+ + delta.tv_usec / 1000);
if (timeout_secs < 0)
timeout_secs = 0;
rv = ftp_poll(pfd, 1, timeout_secs);
Index: src/usr.bin/ftp/util.c
diff -u src/usr.bin/ftp/util.c:1.167 src/usr.bin/ftp/util.c:1.168
--- src/usr.bin/ftp/util.c:1.167 Fri May 5 11:46:06 2023
+++ src/usr.bin/ftp/util.c Wed Sep 25 12:53:58 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: util.c,v 1.167 2023/05/05 15:46:06 lukem Exp $ */
+/* $NetBSD: util.c,v 1.168 2024/09/25 16:53:58 christos Exp $ */
/*-
* Copyright (c) 1997-2023 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: util.c,v 1.167 2023/05/05 15:46:06 lukem Exp $");
+__RCSID("$NetBSD: util.c,v 1.168 2024/09/25 16:53:58 christos Exp $");
#endif /* not lint */
/*
@@ -202,11 +202,11 @@ getremoteinfo(void)
/* determine remote system type */
if (command("SYST") == COMPLETE) {
if (overbose) {
- int os_len = strcspn(reply_string + 4, " \r\n\t");
+ off_t os_len = strcspn(reply_string + 4, " \r\n\t");
if (os_len > 1 && reply_string[4 + os_len - 1] == '.')
os_len--;
fprintf(ttyout, "Remote system type is %.*s.\n",
- os_len, reply_string + 4);
+ (int)os_len, reply_string + 4);
}
/*
* Decide whether we should default to binary.
@@ -311,7 +311,7 @@ cleanuppeer(void)
* Top-level signal handler for interrupted commands.
*/
void
-intr(int signo)
+intr(int signo __unused)
{
sigint_raised = 1;
@@ -949,7 +949,7 @@ list_vertical(StringList *sl)
* Update the global ttywidth value, using TIOCGWINSZ.
*/
void
-setttywidth(int a)
+setttywidth(int a __unused)
{
struct winsize winsize;
int oerrno = errno;
@@ -1072,7 +1072,7 @@ strsuftoi(const char *arg)
if (val < 0 || val > INT_MAX)
return (-1);
- return (val);
+ return (int)(val);
}
/*
@@ -1314,7 +1314,7 @@ get_line(FILE *stream, char *buf, size_t
int rv, ch;
size_t len;
- if (fgets(buf, buflen, stream) == NULL) {
+ if (fgets(buf, (int)buflen, stream) == NULL) {
if (feof(stream)) { /* EOF */
rv = -2;
if (errormsg)
@@ -1340,7 +1340,7 @@ get_line(FILE *stream, char *buf, size_t
}
if (errormsg)
*errormsg = NULL;
- return len;
+ return (int)len;
}
/*
@@ -1431,7 +1431,8 @@ ftp_connect(int sock, const struct socka
if (quit_time > 0) { /* determine timeout */
(void)gettimeofday(&now, NULL);
timersub(&endtime, &now, &td);
- timeout = td.tv_sec * 1000 + td.tv_usec/1000;
+ timeout = (int)(td.tv_sec * 1000
+ + td.tv_usec / 1000);
if (timeout < 0)
timeout = 0;
} else {