Fixes from Todd Miller <Todd.Miller@courtesan.com>:

* use size_t instead of int in places
* use symbolic constants when using access()
This commit is contained in:
lukem 1997-09-13 09:05:52 +00:00
parent 0f0563f57f
commit 87453d32bd
5 changed files with 23 additions and 20 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cmds.c,v 1.27 1997/08/18 10:20:15 lukem Exp $ */
/* $NetBSD: cmds.c,v 1.28 1997/09/13 09:05:52 lukem Exp $ */
/*
* Copyright (c) 1985, 1989, 1993, 1994
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)cmds.c 8.6 (Berkeley) 10/9/94";
#else
__RCSID("$NetBSD: cmds.c,v 1.27 1997/08/18 10:20:15 lukem Exp $");
__RCSID("$NetBSD: cmds.c,v 1.28 1997/09/13 09:05:52 lukem Exp $");
#endif
#endif /* not lint */
@ -887,6 +887,7 @@ setgate(argc, argv)
gateport = htons(port);
}
strncpy(gsbuf, argv[1], sizeof(gsbuf) - 1);
gsbuf[sizeof(gsbuf) - 1] = '\0';
gateserver = gsbuf;
gatemode = 1;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: complete.c,v 1.10 1997/08/18 10:20:18 lukem Exp $ */
/* $NetBSD: complete.c,v 1.11 1997/09/13 09:05:53 lukem Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -40,7 +40,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: complete.c,v 1.10 1997/08/18 10:20:18 lukem Exp $");
__RCSID("$NetBSD: complete.c,v 1.11 1997/09/13 09:05:53 lukem Exp $");
#endif /* not lint */
/*
@ -87,7 +87,8 @@ complete_ambiguous(word, list, words)
{
char insertstr[MAXPATHLEN];
char *lastmatch;
int i, j, matchlen, wordlen;
int i, j;
size_t matchlen, wordlen;
wordlen = strlen(word);
if (words->sl_cur == 0)
@ -141,7 +142,7 @@ complete_command(word, list)
{
struct cmd *c;
StringList *words;
int wordlen;
size_t wordlen;
unsigned char rv;
words = sl_init();
@ -308,7 +309,8 @@ complete(el, ch)
struct cmd *c;
const LineInfo *lf;
int len, celems, dolist;
int celems, dolist;
size_t len;
lf = el_line(el);
len = lf->lastchar - lf->buffer;

View File

@ -1,4 +1,4 @@
/* $NetBSD: fetch.c,v 1.14 1997/08/18 10:20:20 lukem Exp $ */
/* $NetBSD: fetch.c,v 1.15 1997/09/13 09:05:54 lukem Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: fetch.c,v 1.14 1997/08/18 10:20:20 lukem Exp $");
__RCSID("$NetBSD: fetch.c,v 1.15 1997/09/13 09:05:54 lukem Exp $");
#endif /* not lint */
/*
@ -515,7 +515,7 @@ parsed_url:
}
/*
* If cp is NULL, the file wasn't specified
* If dir is NULL, the file wasn't specified
* (URL looked something like ftp://host)
*/
if (dir != NULL)

View File

@ -1,4 +1,4 @@
/* $NetBSD: ftp.c,v 1.27 1997/08/18 10:20:23 lukem Exp $ */
/* $NetBSD: ftp.c,v 1.28 1997/09/13 09:05:56 lukem Exp $ */
/*
* Copyright (c) 1985, 1989, 1993, 1994
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)ftp.c 8.6 (Berkeley) 10/27/94";
#else
__RCSID("$NetBSD: ftp.c,v 1.27 1997/08/18 10:20:23 lukem Exp $");
__RCSID("$NetBSD: ftp.c,v 1.28 1997/09/13 09:05:56 lukem Exp $");
#endif
#endif /* not lint */
@ -716,7 +716,7 @@ recvrequest(cmd, local, remote, lmode, printnames, ignorespecial)
sig_t oldinti, oldintr, oldintp;
int c, d;
volatile int is_retr, tcrflag, bare_lfs;
static int bufsize;
static size_t bufsize;
static char *buf;
volatile off_t hashbytes;
struct stat st;
@ -780,7 +780,7 @@ recvrequest(cmd, local, remote, lmode, printnames, ignorespecial)
oldintr = signal(SIGINT, abortrecv);
oldinti = signal(SIGINFO, psummary);
if (ignorespecial || (strcmp(local, "-") && *local != '|')) {
if (access(local, 2) < 0) {
if (access(local, W_OK) < 0) {
char *dir = strrchr(local, '/');
if (errno != ENOENT && errno != EACCES) {
@ -792,7 +792,7 @@ recvrequest(cmd, local, remote, lmode, printnames, ignorespecial)
}
if (dir != NULL)
*dir = 0;
d = access(dir == local ? "/" : dir ? local : ".", 2);
d = access(dir == local ? "/" : dir ? local : ".", W_OK);
if (dir != NULL)
*dir = '/';
if (d < 0) {
@ -1523,7 +1523,7 @@ gunique(local)
if (cp)
*cp = '\0';
d = access(cp == local ? "/" : cp ? local : ".", 2);
d = access(cp == local ? "/" : cp ? local : ".", W_OK);
if (cp)
*cp = '/';
if (d < 0) {
@ -1544,7 +1544,7 @@ gunique(local)
ext = '0';
else
ext++;
if ((d = access(new, 0)) < 0)
if ((d = access(new, F_OK)) < 0)
break;
if (ext != '0')
cp--;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ftp_var.h,v 1.19 1997/08/23 07:32:53 lukem Exp $ */
/* $NetBSD: ftp_var.h,v 1.20 1997/09/13 09:05:58 lukem Exp $ */
/*
* Copyright (c) 1985, 1989, 1993, 1994
@ -122,8 +122,8 @@ int editing; /* command line editing enabled */
EditLine *el; /* editline(3) status structure */
History *hist; /* editline(3) history structure */
char *cursor_pos; /* cursor position we're looking for */
int cursor_argc; /* location of cursor in margv */
int cursor_argo; /* offset of cursor in margv[cursor_argc] */
size_t cursor_argc; /* location of cursor in margv */
size_t cursor_argo; /* offset of cursor in margv[cursor_argc] */
#endif /* !SMALL */
off_t bytes; /* current # of bytes read */