diff src/gtk/view_dialog.c @ 58:c01d91c10f6c

2002-11-20 Brian Masney <masneyb@gftp.org> * lib/protocols.c lib/gftp.h - added gftp_get_line(), gftp_read(), gftp_write(), gftp_writefmt(), and gftp_set_sockblocking() functions. Added struct_gftp_getline_buffer for gftp_get_line function() * lib/cache.c lib/gftp.h lib/local.c lib/misc.c lib/protocols.c lib/rfc2068.c lib/rfc959.c lib/ssh.c lib/sshv2.c - *_get_file() returns off_t instead of long. *_{get,put}_next_file_chunk returns ssize_t instead of size_t. Added *_set_config_options function to gftp_request structure and protocol files. Use the new network functions documented above. Convert usage of ANSI C IO (FILE *) to standard BSD sockets so that I can use timeouts properly with select * lib/misc.c (ssh_start_login_sequence) - use gftp_set_sockblock(), gftp_read() and gftp_write() functions * lib/protocols.c - move some protocol specific code to the protocol specific files * lib/local.c - log succesful messages to gftp_logging_misc instead of gftp_logging_error * lib/cache.c - log some more error conditions to the user * lib/rfc959.c - added rfc959_getcwd(). In, rfc959_accept_active_connection(), set set socket to blocking mode before calling accept() * src/text/gftk-text.c - If we get no files in gftp_text_ls(), return instead of segfaulting * src/gtk/gftp-gtk.c - expand the port field in the toolbar to be 45 pixels wide * src/text/gftp-text.c src/gtk/misc-gtk.c src/gtk/transfer.c src/gtk/view_dialog.c - changes for conversion of request->{sock,data} from ANSI C IO (FILE *) to standard BSD sockets
author masneyb
date Thu, 21 Nov 2002 00:33:51 +0000
parents e5f6054590b5
children fe0b21c006f6
line wrap: on
line diff
--- a/src/gtk/view_dialog.c	Tue Nov 12 00:04:44 2002 +0000
+++ b/src/gtk/view_dialog.c	Thu Nov 21 00:33:51 2002 +0000
@@ -28,7 +28,7 @@
   GList * templist, * filelist, * newfile;
   gftp_window_data * fromwdata, * towdata;
   gftp_file * new_fle;
-  int num, fd;
+  int num;
 
   fromwdata = data;
   towdata = fromwdata == &window1 ? &window2 : &window1;
@@ -56,7 +56,7 @@
       if (new_fle->destfile)
         g_free (new_fle->destfile);
       new_fle->destfile = g_strconcat (g_get_tmp_dir (), "/gftp-view.XXXXXX", NULL);
-      if ((fd = mkstemp (new_fle->destfile)) < 0)
+      if ((new_fle->fd = mkstemp (new_fle->destfile)) < 0)
         {
           ftp_log (gftp_logging_misc, NULL, 
                    _("Error: Cannot open %s for writing: %s\n"),  
@@ -65,14 +65,7 @@
           return;
         }
 
-      chmod (new_fle->destfile, S_IRUSR | S_IWUSR);
-      if ((new_fle->fd = fdopen (fd, "rw+")) == NULL)
-        {
-          ftp_log (gftp_logging_error, NULL,
-                   _("Cannot fdopen() socket: %s\n"),
-                   g_strerror (errno));
-          return;
-        }
+      fchmod (new_fle->fd, S_IRUSR | S_IWUSR);
 
       new_fle->is_fd = 1;
       new_fle->done_view = 1;
@@ -90,7 +83,7 @@
   gftp_window_data * fromwdata, * towdata;
   GList * templist, * filelist, * newfile;
   gftp_file * new_fle;
-  int num, fd;
+  int num;
 
   fromwdata = data;
   towdata = fromwdata == &window1 ? &window2 : &window1;
@@ -126,7 +119,7 @@
         g_free (new_fle->destfile);
       new_fle->destfile = g_strconcat (g_get_tmp_dir (), "/gftp-view.XXXXXX",
                                        NULL);
-      if ((fd = mkstemp (new_fle->destfile)) < 0)
+      if ((new_fle->fd = mkstemp (new_fle->destfile)) < 0)
         {
           ftp_log (gftp_logging_misc, NULL, 
                    _("Error: Cannot open %s for writing: %s\n"),
@@ -135,14 +128,7 @@
           return;
         }
 
-      chmod (new_fle->destfile, S_IRUSR | S_IWUSR);
-      if ((new_fle->fd = fdopen (fd, "rw+")) == NULL)
-        {
-          ftp_log (gftp_logging_error, NULL,
-                   _("Cannot fdopen() socket: %s\n"),
-                   g_strerror (errno));
-          return;
-        }
+      fchmod (new_fle->fd, S_IRUSR | S_IWUSR);
 
       new_fle->is_fd = 1;
       new_fle->done_edit = 1;