Subject: Re: libssh2 master c28fa65 bugfix: avoid using the socket if it failed to create one

Re: libssh2 master c28fa65 bugfix: avoid using the socket if it failed to create one

From: Peter Stuge <peter_at_stuge.se>
Date: Tue, 27 Apr 2010 19:47:10 +0200

libssh2_at_git.stuge.se wrote:
> +++ b/example/scp_write.c
> @@ -94,6 +94,10 @@ int main(int argc, char *argv[])
> * connection
> */
> sock = socket(AF_INET, SOCK_STREAM, 0);
> + if(-1 == sock) {
> + fprintf(stderr, "failed to create socket!\n");
> + return -1;
> + }

Maybe

#ifdef WIN32
if (INVALID_SOCKET == sock) {
#else
if (-1 == sock) {
#endif

but it's kinda ugly.

//Peter
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-04-27