summaryrefslogtreecommitdiff
path: root/usr.bin/nc
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2005-02-08 15:26:24 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2005-02-08 15:26:24 +0000
commitb26755be134bf0801652218bc6dff084e882669c (patch)
treec56686182fdaea585344f35df029e3a5a7a132b3 /usr.bin/nc
parent081a043236fed88ad0e3bebab03b61cbad967c24 (diff)
Some extra strict warning cleanup. From Xin Li <delphij at FreeBSD
dot ORG> with a twist from myself. No binary change. ok djm@
Diffstat (limited to 'usr.bin/nc')
-rw-r--r--usr.bin/nc/atomicio.c2
-rw-r--r--usr.bin/nc/netcat.c10
-rw-r--r--usr.bin/nc/socks.c15
3 files changed, 14 insertions, 13 deletions
diff --git a/usr.bin/nc/atomicio.c b/usr.bin/nc/atomicio.c
index 9e732904adc..151dde0cf66 100644
--- a/usr.bin/nc/atomicio.c
+++ b/usr.bin/nc/atomicio.c
@@ -40,7 +40,7 @@ atomicio(ssize_t (*f) (int, void *, size_t), int fd, void *_s, size_t n)
char *s = _s;
ssize_t res, pos = 0;
- while (n > pos) {
+ while (n > (size_t)pos) {
res = (f) (fd, s + pos, n - pos);
switch (res) {
case -1:
diff --git a/usr.bin/nc/netcat.c b/usr.bin/nc/netcat.c
index 3c610b9913b..01490081857 100644
--- a/usr.bin/nc/netcat.c
+++ b/usr.bin/nc/netcat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: netcat.c,v 1.76 2004/12/10 16:51:31 hshoexer Exp $ */
+/* $OpenBSD: netcat.c,v 1.77 2005/02/08 15:26:23 otto Exp $ */
/*
* Copyright (c) 2001 Eric Jackson <ericj@monkey.org>
*
@@ -86,8 +86,8 @@ void build_ports(char *);
void help(void);
int local_listen(char *, char *, struct addrinfo);
void readwrite(int);
-int remote_connect(char *, char *, struct addrinfo);
-int socks_connect(char *, char *, struct addrinfo, char *, char *,
+int remote_connect(const char *, const char *, struct addrinfo);
+int socks_connect(const char *, const char *, struct addrinfo, const char *, const char *,
struct addrinfo, int);
int udptest(int);
int unix_connect(char *);
@@ -104,7 +104,7 @@ main(int argc, char *argv[])
socklen_t len;
struct sockaddr_storage cliaddr;
char *proxy;
- char *proxyhost = "", *proxyport = NULL;
+ const char *proxyhost = "", *proxyport = NULL;
struct addrinfo proxyhints;
ret = 1;
@@ -452,7 +452,7 @@ unix_listen(char *path)
* port or source address if needed. Returns -1 on failure.
*/
int
-remote_connect(char *host, char *port, struct addrinfo hints)
+remote_connect(const char *host, const char *port, struct addrinfo hints)
{
struct addrinfo *res, *res0;
int s, error, x = 1;
diff --git a/usr.bin/nc/socks.c b/usr.bin/nc/socks.c
index e7d35b601a0..035898e7e6d 100644
--- a/usr.bin/nc/socks.c
+++ b/usr.bin/nc/socks.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: socks.c,v 1.9 2004/10/17 03:13:55 djm Exp $ */
+/* $OpenBSD: socks.c,v 1.10 2005/02/08 15:26:23 otto Exp $ */
/*
* Copyright (c) 1999 Niklas Hallqvist. All rights reserved.
@@ -48,9 +48,9 @@
#define SOCKS_IPV4 1
-int remote_connect(char *, char *, struct addrinfo);
-int socks_connect(char *host, char *port, struct addrinfo hints,
- char *proxyhost, char *proxyport, struct addrinfo proxyhints,
+int remote_connect(const char *, const char *, struct addrinfo);
+int socks_connect(const char *host, const char *port, struct addrinfo hints,
+ const char *proxyhost, const char *proxyport, struct addrinfo proxyhints,
int socksv);
static in_addr_t
@@ -110,8 +110,9 @@ proxy_read_line(int fd, char *buf, int bufsz)
}
int
-socks_connect(char *host, char *port, struct addrinfo hints,
- char *proxyhost, char *proxyport, struct addrinfo proxyhints,
+socks_connect(const char *host, const char *port,
+ struct addrinfo hints __attribute__ ((__unused__)),
+ const char *proxyhost, const char *proxyport, struct addrinfo proxyhints,
int socksv)
{
int proxyfd, r;
@@ -208,7 +209,7 @@ socks_connect(char *host, char *port, struct addrinfo hints,
"CONNECT %s:%d HTTP/1.0\r\n\r\n",
host, ntohs(serverport));
}
- if (r == -1 || r >= sizeof(buf))
+ if (r == -1 || (size_t)r >= sizeof(buf))
errx (1, "hostname too long");
r = strlen(buf);