- (dtucker) [progressmeter.c scp.c sftp-server.c] Use correct casts for

snprintf formats, fixes warnings on some 64 bit platforms.  Patch from
   shaw at vranix.com, ok djm@
This commit is contained in:
Darren Tucker 2005-11-25 14:44:55 +11:00
parent 58e298d11b
commit e0be30426a
4 changed files with 10 additions and 7 deletions

View File

@ -2,6 +2,9 @@
- (dtucker) [configure.ac] Apply tim's fix for older systems where the
resolver state in resolv.h is "state" not "__res_state". With slight
modification by me to also work on old AIXes. ok djm@
- (dtucker) [progressmeter.c scp.c sftp-server.c] Use correct casts for
snprintf formats, fixes warnings on some 64 bit platforms. Patch from
shaw at vranix.com, ok djm@
20051124
- (djm) [configure.ac openbsd-compat/Makefile.in openbsd-compat/bsd-asprintf.c
@ -3349,4 +3352,4 @@
- (djm) Trim deprecated options from INSTALL. Mention UsePAM
- (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
$Id: ChangeLog,v 1.4006 2005/11/25 02:14:58 dtucker Exp $
$Id: ChangeLog,v 1.4007 2005/11/25 03:44:55 dtucker Exp $

View File

@ -85,8 +85,8 @@ format_rate(char *buf, int size, off_t bytes)
bytes = (bytes + 512) / 1024;
}
snprintf(buf, size, "%3lld.%1lld%c%s",
(int64_t) (bytes + 5) / 100,
(int64_t) (bytes + 5) / 10 % 10,
(long long) (bytes + 5) / 100,
(long long) (bytes + 5) / 10 % 10,
unit[i],
i ? "B" : " ");
}
@ -99,7 +99,7 @@ format_size(char *buf, int size, off_t bytes)
for (i = 0; bytes >= 10000 && unit[i] != 'T'; i++)
bytes = (bytes + 512) / 1024;
snprintf(buf, size, "%4lld%c%s",
(int64_t) bytes,
(long long) bytes,
unit[i],
i ? "B" : " ");
}

2
scp.c
View File

@ -563,7 +563,7 @@ syserr: run_err("%s: %s", name, strerror(errno));
#define FILEMODEMASK (S_ISUID|S_ISGID|S_IRWXU|S_IRWXG|S_IRWXO)
snprintf(buf, sizeof buf, "C%04o %lld %s\n",
(u_int) (stb.st_mode & FILEMODEMASK),
(int64_t)stb.st_size, last);
(long long)stb.st_size, last);
if (verbose_mode) {
fprintf(stderr, "Sending file modes: %s", buf);
}

View File

@ -428,7 +428,7 @@ process_read(void)
len = get_int();
TRACE("read id %u handle %d off %llu len %d", id, handle,
(u_int64_t)off, len);
(unsigned long long)off, len);
if (len > sizeof buf) {
len = sizeof buf;
logit("read change len %d", len);
@ -469,7 +469,7 @@ process_write(void)
data = get_string(&len);
TRACE("write id %u handle %d off %llu len %d", id, handle,
(u_int64_t)off, len);
(unsigned long long)off, len);
fd = handle_to_fd(handle);
if (fd >= 0) {
if (lseek(fd, off, SEEK_SET) < 0) {