[PATCH] Fixes space handling in symlinks on ftp
Yann Rouillard <[email protected]>
| Newsgroups | gmane.comp.gnome.vfs.general |
|---|---|
| Message-ID | <1192983848.5819.6.camel@celaeno> |
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 _______________________________________________ gnome-vfs-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/gnome-vfs-list
32_handle_ftp_symlink_with_space.patch
(text/x-patch, 904 B)
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 {