aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2011-04-15 18:55:30 +0200
committerAndreas Schneider <asn@cryptomilk.org>2011-04-15 18:56:52 +0200
commita6c53d51de3601058d990d2f2d99649760cd3029 (patch)
treedfc30c401d7dbec725099d99f2244a25a5620b8f
parente7e4f261a6182f9b26484f3d97c3f21573d04bd6 (diff)
downloadlibssh-a6c53d51de3601058d990d2f2d99649760cd3029.tar.gz
libssh-a6c53d51de3601058d990d2f2d99649760cd3029.tar.xz
libssh-a6c53d51de3601058d990d2f2d99649760cd3029.zip
scp: More correct fix for snprintf 64-bit format.
-rw-r--r--include/libssh/priv.h8
-rw-r--r--src/scp.c4
2 files changed, 10 insertions, 2 deletions
diff --git a/include/libssh/priv.h b/include/libssh/priv.h
index 4dbc445..de965f5 100644
--- a/include/libssh/priv.h
+++ b/include/libssh/priv.h
@@ -39,6 +39,14 @@
# define PRIdS "Id"
# endif
+# ifndef PRIu64
+# if __WORDSIZE == 64
+# define PRIu64 "lu"
+# else
+# define PRIu64 "llu"
+# endif /* __WORDSIZE */
+# endif /* PRIu64 */
+
# ifdef _MSC_VER
# include <stdio.h>
diff --git a/src/scp.c b/src/scp.c
index 0cebf8d..8a38c87 100644
--- a/src/scp.c
+++ b/src/scp.c
@@ -293,8 +293,8 @@ int ssh_scp_push_file64(ssh_scp scp, const char *filename, uint64_t size, int mo
}
file=ssh_basename(filename);
perms=ssh_scp_string_mode(mode);
- ssh_log(scp->session,SSH_LOG_PROTOCOL,"SCP pushing file %s, size %llu with permissions '%s'",file,size,perms);
- snprintf(buffer, sizeof(buffer), "C%s %llu %s\n", perms, size, file);
+ ssh_log(scp->session,SSH_LOG_PROTOCOL,"SCP pushing file %s, size %" PRIu64 " with permissions '%s'",file,size,perms);
+ snprintf(buffer, sizeof(buffer), "C%s %" PRIu64 " %s\n", perms, size, file);
SAFE_FREE(file);
SAFE_FREE(perms);
r=ssh_channel_write(scp->channel,buffer,strlen(buffer));