diff lib/rfc959.c @ 60:8a9324fb63a4

2002-11-21 Brian Masney <masneyb@gftp.org> * lib/protocols.c (gftp_get_next_line) - fixed several bugs * lib/cache.c - Don't do a cache lookup in gftp_new_cache_entry(). In gftp_find_cache_entry(), don't log an error to the user if we can't open up the cache file * lib/rfc959.c lib/rfc2068.c lib/protocols.c - small cache fixes * lib/cache.c lib/rfc2068.c lib/rfc959.c - pass full buffer size instead of buffer size - 1 to gftp_get_line
author masneyb
date Fri, 22 Nov 2002 00:54:38 +0000
parents c01d91c10f6c
children 41b71c4e5076
line wrap: on
line diff
--- a/lib/rfc959.c	Thu Nov 21 02:49:06 2002 +0000
+++ b/lib/rfc959.c	Fri Nov 22 00:54:38 2002 +0000
@@ -50,8 +50,7 @@
   do
     {
       if ((num_read = gftp_get_line (request, &parms->sockfd_rbuf, tempstr, 
-                                     sizeof (tempstr) - 1, 
-                                     request->sockfd)) <= 0)
+                                     sizeof (tempstr), request->sockfd)) <= 0)
 	break;
 
       if (isdigit ((int) *tempstr) && isdigit ((int) *(tempstr + 1))
@@ -895,7 +894,7 @@
   do
     {
       if ((len = gftp_get_line (request, &parms->datafd_rbuf,
-                                tempstr, sizeof (tempstr) - 1, fd)) <= 0)
+                                tempstr, sizeof (tempstr), fd)) <= 0)
 	{
           gftp_file_destroy (fle);
 	  return ((int) len);
@@ -919,9 +918,8 @@
   len = strlen (tempstr);
   if (!request->cached)
     {
-      request->last_dir_entry = g_malloc (len + 1);
-      strcpy (request->last_dir_entry, tempstr);
-      request->last_dir_entry_len = len;
+      request->last_dir_entry = g_strdup_printf ("%s\n", tempstr);
+      request->last_dir_entry_len = len + 1;
     }
   return (len);
 }