diff lib/local.c @ 66:cd3e457cbc85

2002-11-26 Brian Masney <masneyb@gftp.org> * configure.in - change version to 2.0.14rc1 * lib/local.c - fix for uploading files. Move setting of hostname from local_connect() to local_init() * lib/misc.c (gftp_request) - copy only select fields over instead of whole structure * lib/protocols.c (gftp_request_new) - set datafd and cachefd to -1 * lib/protocols.c (gftp_set_proxy_config) - allow a NULL proxy_config to be passed * src/gtk/misc-gtk.c (update_window) - don't show the hostname if we are connected via the local protocol * src/gtk/transfer.c (create_transfer) - check to see if this protocol is always connected
author masneyb
date Wed, 27 Nov 2002 02:23:51 +0000
parents 4b5fec7711e9
children 7ef60ce2bdb2
line wrap: on
line diff
--- a/lib/local.c	Tue Nov 26 14:58:13 2002 +0000
+++ b/lib/local.c	Wed Nov 27 02:23:51 2002 +0000
@@ -59,9 +59,6 @@
   g_return_val_if_fail (request != NULL, -2);
   g_return_val_if_fail (request->protonum == GFTP_LOCAL_NUM, -2);
 
-  if (request->hostname == NULL)
-    request->hostname = g_strdup (_("local filesystem"));
-
   if (request->directory)
     {
       if (chdir (request->directory) != 0)
@@ -117,7 +114,7 @@
   g_return_val_if_fail (request->protonum == GFTP_LOCAL_NUM, -2);
   g_return_val_if_fail (filename != NULL, -2);
 
-  if (fd > 0)
+  if (fd <= 0)
     {
       flags = O_RDONLY;
 #if defined (_LARGEFILE_SOURCE)
@@ -167,7 +164,7 @@
   g_return_val_if_fail (request->protonum == GFTP_LOCAL_NUM, -2);
   g_return_val_if_fail (filename != NULL, -2);
 
-  if (fd < 0)
+  if (fd <= 0)
     {
       flags = O_WRONLY | O_CREAT;
       if (startsize > 0)
@@ -701,5 +698,9 @@
   request->protocol_data = lpd;
   lpd->userhash = g_hash_table_new (hash_function, hash_compare);
   lpd->grouphash = g_hash_table_new (hash_function, hash_compare);
+
+  if (request->hostname != NULL)
+    g_free (request->hostname);
+  request->hostname = g_strdup (_("local filesystem"));
 }