Mercurial > gftp.yaz
diff lib/ssh.c @ 14:83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
* Sanity checking on the fdopen() calls. Also make sure that all of them have a + in their open mode. Doesn't affect UNIX, but it does affect Windows
* HTTP fixes when running under Solaris. Read from request->sockfd and write to request->sockfd_write (Solaris doesn't like it when you read/write to the same FILE structure)
* Display major/minor properly for a device when connected with the local protocol
author | masneyb |
---|---|
date | Wed, 04 Sep 2002 11:45:56 +0000 |
parents | 8b1883341c6f |
children | c8ec7877432e |
line wrap: on
line diff
--- a/lib/ssh.c Fri Aug 30 19:46:27 2002 +0000 +++ b/lib/ssh.c Wed Sep 04 11:45:56 2002 +0000 @@ -298,8 +298,23 @@ g_free (exepath); g_free (tempstr); - request->sockfd = request->datafd = fdopen (fdm, "rb"); - request->sockfd_write = fdopen (fdm, "wb"); + if ((request->sockfd = fdopen (fdm, "rb+")) == NULL) + { + request->logging_function (gftp_logging_error, request->user_data, + _("Cannot fdopen() socket: %s\n"), + g_strerror (errno)); + close (fdm); + return (-2); + } + + if ((request->sockfd_write = fdopen (fdm, "wb+")) == NULL) + { + request->logging_function (gftp_logging_error, request->user_data, + _("Cannot fdopen() socket: %s\n"), + g_strerror (errno)); + gftp_disconnect (request); + return (-2); + } params->channel = 0; version = htonl (7 << 4); @@ -359,7 +374,7 @@ _("Disconnecting from site %s\n"), request->hostname); fclose (request->sockfd); - request->sockfd = request->datafd = request->sockfd_write = NULL; + request->sockfd = request->sockfd_write = NULL; } } @@ -470,8 +485,10 @@ if (startsize > 0) { startsize = htonl (startsize); - /* FIXME - warning on IRIX - pointer from integer of different size */ - if (ssh_send_command (request, SKIPBYTES, GUINT_TO_POINTER (startsize), 4) < 0) + /* This protocol only supports files up to 2 gig in size. I truncate + the file size here just to suppress compiler warnings */ + if (ssh_send_command (request, SKIPBYTES, + GINT_TO_POINTER ((gint32) startsize), 4) < 0) return (-1); } @@ -536,7 +553,6 @@ g_return_val_if_fail (request != NULL, -2); g_return_val_if_fail (request->protonum == GFTP_SSH_NUM, -2); - g_return_val_if_fail (request->datafd != NULL, -2); params = request->protocol_data; if (params->buffer)