On Sunday 06 of December 2009 17:54:22 Peter Stuge wrote: > The examples are in really bad shape overall. I would prefer that > they were polished and improved, rather than macros added to ignore > write() return codes.
As for that macros, I needed to write it anyway to make our build systems happy. Otherwise it's hard to explain to package reviewers which warnings are relevant etc. > All the other changes, for missing initializations and such, are > great! Could you make them into a separate patch? Here we go. Kamil
From 5d131d95795ed581e4795fdd2f213f3700961314 Mon Sep 17 00:00:00 2001 From: Kamil Dudka <kdu...@redhat.com> Date: Sun, 6 Dec 2009 18:03:39 +0100 Subject: [PATCH] fix some gcc warnings --- example/simple/scp_write.c | 4 ++-- example/simple/scp_write_nonblock.c | 4 ++-- example/simple/sftp_write.c | 4 ++-- example/simple/sftp_write_nonblock.c | 4 ++-- src/channel.c | 2 +- src/publickey.c | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/example/simple/scp_write.c b/example/simple/scp_write.c index f6af186..d455479 100644 --- a/example/simple/scp_write.c +++ b/example/simple/scp_write.c @@ -35,10 +35,10 @@ int main(int argc, char *argv[]) { unsigned long hostaddr; - int sock, i, auth_pw = 1; + int sock = 0, i, auth_pw = 1; struct sockaddr_in sin; const char *fingerprint; - LIBSSH2_SESSION *session; + LIBSSH2_SESSION *session = NULL; LIBSSH2_CHANNEL *channel; const char *username="username"; const char *password="password"; diff --git a/example/simple/scp_write_nonblock.c b/example/simple/scp_write_nonblock.c index 092505e..caab05c 100644 --- a/example/simple/scp_write_nonblock.c +++ b/example/simple/scp_write_nonblock.c @@ -36,10 +36,10 @@ int main(int argc, char *argv[]) { unsigned long hostaddr; - int sock, i, auth_pw = 1; + int sock = 0, i, auth_pw = 1; struct sockaddr_in sin; const char *fingerprint; - LIBSSH2_SESSION *session; + LIBSSH2_SESSION *session = NULL; LIBSSH2_CHANNEL *channel; const char *username="username"; const char *password="password"; diff --git a/example/simple/sftp_write.c b/example/simple/sftp_write.c index 4d583ab..9a3f25b 100644 --- a/example/simple/sftp_write.c +++ b/example/simple/sftp_write.c @@ -38,10 +38,10 @@ int main(int argc, char *argv[]) { unsigned long hostaddr; - int sock, i, auth_pw = 1; + int sock = 0, i, auth_pw = 1; struct sockaddr_in sin; const char *fingerprint; - LIBSSH2_SESSION *session; + LIBSSH2_SESSION *session = NULL; const char *username="username"; const char *password="password"; const char *loclfile="sftp_write.c"; diff --git a/example/simple/sftp_write_nonblock.c b/example/simple/sftp_write_nonblock.c index a40046f..25f3301 100644 --- a/example/simple/sftp_write_nonblock.c +++ b/example/simple/sftp_write_nonblock.c @@ -38,10 +38,10 @@ int main(int argc, char *argv[]) { unsigned long hostaddr; - int sock, i, auth_pw = 1; + int sock = 0, i, auth_pw = 1; struct sockaddr_in sin; const char *fingerprint; - LIBSSH2_SESSION *session; + LIBSSH2_SESSION *session = NULL; const char *username="username"; const char *password="password"; const char *loclfile="sftp_write_nonblock.c"; diff --git a/src/channel.c b/src/channel.c index 06e0e77..ea42be4 100644 --- a/src/channel.c +++ b/src/channel.c @@ -1285,7 +1285,7 @@ _libssh2_channel_process_startup(LIBSSH2_CHANNEL *channel, const char *message, unsigned int message_len) { LIBSSH2_SESSION *session = channel->session; - unsigned char *s, *data; + unsigned char *s, *data = NULL; static const unsigned char reply_codes[3] = { SSH_MSG_CHANNEL_SUCCESS, SSH_MSG_CHANNEL_FAILURE, 0 }; unsigned long data_len; diff --git a/src/publickey.c b/src/publickey.c index 8ca499c..aa1bbb7 100644 --- a/src/publickey.c +++ b/src/publickey.c @@ -344,7 +344,7 @@ libssh2_publickey_init(LIBSSH2_SESSION * session) { /* 19 = packet_len(4) + version_len(4) + "version"(7) + version_num(4) */ unsigned char buffer[19]; - unsigned char *s; + unsigned char *s = NULL; int response; int rc; -- 1.6.2.5
_______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel