[PATCH] Fixes space handling in symlinks on ftp
- From: Yann Rouillard <yann pleiades fr eu org>
- To: gnome-vfs-list gnome org
- Subject: [PATCH] Fixes space handling in symlinks on ftp
- Date: Sun, 21 Oct 2007 18:24:08 +0200
The attached patch fixes a bug in the ftp ls output parsing code.
Spaces in symlink name and symlink target were not correctly handled because the name was extracted from the tokenized string instead of the original one.
The corresponding bugzilla issue is http://bugzilla.gnome.org/show_bug.cgi?id=332676
Yann
diff -Nur gnome-vfs2-2.20.0/libgnomevfs/gnome-vfs-parse-ls.c gnome-vfs2-2.20.0.new/libgnomevfs/gnome-vfs-parse-ls.c
--- gnome-vfs2-2.20.0/libgnomevfs/gnome-vfs-parse-ls.c 2007-03-30 09:52:28.000000000 +0200
+++ gnome-vfs2-2.20.0.new/libgnomevfs/gnome-vfs-parse-ls.c 2007-10-20 17:30:53.000000000 +0200
@@ -674,18 +674,13 @@
char *s;
if (filename) {
- s = g_strndup (p_copy + column_ptr [idx],
+ s = g_strndup (p_pristine + column_ptr [idx],
column_ptr [idx2] - column_ptr [idx] - 1);
*filename = s;
}
if (linkname) {
- s = g_strdup (p_copy + column_ptr [idx2+1]);
- p = strlen (s);
- if (s [p-1] == '\r' || s [p-1] == '\n')
- s [p-1] = 0;
- if (s [p-2] == '\r' || s [p-2] == '\n')
- s [p-2] = 0;
-
+ p = strcspn (p_pristine + column_ptr[idx2+1], "\r\n");
+ s = g_strndup (p_pristine + column_ptr [idx2+1], p);
*linkname = s;
}
} else {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]