[scp.c]
     Prevent -Wsign-compare warnings on LP64 systems.  bz #1192, ok deraadt@
This commit is contained in:
Darren Tucker 2008-06-14 09:02:25 +10:00
parent 47e713be94
commit 03ccc9b142
2 changed files with 12 additions and 4 deletions

View File

@ -15,6 +15,9 @@
- dtucker@cvs.openbsd.org 2008/06/13 17:21:20
[mux.c]
Friendlier error messages for mux fallback. ok djm@
- dtucker@cvs.openbsd.org 2008/06/13 18:55:22
[scp.c]
Prevent -Wsign-compare warnings on LP64 systems. bz #1192, ok deraadt@
20080612
- (dtucker) OpenBSD CVS Sync
@ -4353,4 +4356,4 @@
OpenServer 6 and add osr5bigcrypt support so when someone migrates
passwords between UnixWare and OpenServer they will still work. OK dtucker@
$Id: ChangeLog,v 1.5007 2008/06/13 23:01:54 dtucker Exp $
$Id: ChangeLog,v 1.5008 2008/06/13 23:02:25 dtucker Exp $

11
scp.c
View File

@ -1,4 +1,4 @@
/* $OpenBSD: scp.c,v 1.162 2008/01/01 09:06:39 dtucker Exp $ */
/* $OpenBSD: scp.c,v 1.163 2008/06/13 18:55:22 dtucker Exp $ */
/*
* scp - secure remote copy. This is basically patched BSD rcp which
* uses ssh to do the data transfer (instead of using rcmd).
@ -629,7 +629,8 @@ source(int argc, char **argv)
struct stat stb;
static BUF buffer;
BUF *bp;
off_t i, amt, statbytes;
off_t i, statbytes;
size_t amt;
int fd = -1, haderr, indx;
char *last, *name, buf[2048], encname[MAXPATHLEN];
int len;
@ -650,6 +651,10 @@ source(int argc, char **argv)
syserr: run_err("%s: %s", name, strerror(errno));
goto next;
}
if (stb.st_size < 0) {
run_err("%s: %s", name, "Negative file size");
goto next;
}
unset_nonblock(fd);
switch (stb.st_mode & S_IFMT) {
case S_IFREG:
@ -709,7 +714,7 @@ next: if (fd != -1) {
set_nonblock(remout);
for (haderr = i = 0; i < stb.st_size; i += bp->cnt) {
amt = bp->cnt;
if (i + amt > stb.st_size)
if (i + (off_t)amt > stb.st_size)
amt = stb.st_size - i;
if (!haderr) {
if (atomicio(read, fd, bp->buf, amt) != amt)