Hi,
some time ago some patches of mine were integrated into
ftpfs/libftpconn. Those patches fixed a bug, but also broke ftpfs in
a way: I just noticed that
$ cd foo; cd bar; ls
shows the content of 'foo' while
$ cd foo; ls; cd bar; ls
shows the content of 'bar'.
The problem, which I introduced with my patches, was that I used
dirname() without keeping in mind that the original path is modified
after using that function. Here is a patch against libftpconn/unix.c.
2002-10-17 Moritz Schulte <[EMAIL PROTECTED]>
* unix.c (ftp_conn_unix_start_get_stats): Call dirname() with
a copy of name instead of the original name.
--- unix.c 20 Apr 2002 03:22:47 -0000 1.11
+++ unix.c 17 Oct 2002 15:45:39 -0000
@@ -224,14 +224,21 @@
than looking it up directly, as not all ftp servers support
the -d option to ls. To make sure we get a directory, append
'/', except for the root directory. */
- char *dirn = dirname ((char *) name);
- int is_root = ! strcmp (dirn, "/");
- req_len += strlen (dirn) + (is_root ? 0 : 1);
- req = malloc (req_len);
- if (! req)
- err = ENOMEM;
+ char *name_cp = strdup ((char *) name);
+ if (name_cp)
+ {
+ char *dirn = dirname (name_cp);
+ int is_root = ! strcmp (dirn, "/");
+ req_len += strlen (dirn) + (is_root ? 0 : 1);
+ req = malloc (req_len);
+ if (! req)
+ err = ENOMEM;
+ else
+ sprintf (req, "%s %s%s", flags, dirn, (is_root ? "" : "/"));
+ free (name_cp);
+ }
else
- sprintf (req, "%s %s%s", flags, dirn, (is_root ? "" : "/"));
+ err = ENOMEM;
}
else
{
moritz
--
[EMAIL PROTECTED] - http://duesseldorf.ccc.de/~moritz/
GPG fingerprint = 3A14 3923 15BE FD57 FC06 B501 0841 2D7B 6F98 4199
_______________________________________________
Bug-hurd mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-hurd