[gvfs] ftp: Fix directory parsing error on AIX.
- From: Ross Lagerwall <rossl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs] ftp: Fix directory parsing error on AIX.
- Date: Sun, 8 Mar 2015 09:10:15 +0000 (UTC)
commit 93fbba7d28c98101498975c53ba57e2527037710
Author: Ross Lagerwall <rosslagerwall gmail com>
Date: Sat Feb 28 12:38:45 2015 +0000
ftp: Fix directory parsing error on AIX.
Fix from upstream:
http://hg.mozilla.org/mozilla-central/rev/b623418ab1de
https://bugzilla.mozilla.org/show_bug.cgi?id=543805
https://bugzilla.gnome.org/show_bug.cgi?id=601583
daemon/ParseFTPList.c | 21 +++++++++++++++------
1 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/daemon/ParseFTPList.c b/daemon/ParseFTPList.c
index 2d2ce0f..0bd64b8 100644
--- a/daemon/ParseFTPList.c
+++ b/daemon/ParseFTPList.c
@@ -1196,12 +1196,21 @@ int ParseFTPList(const char *line, struct list_state *state,
} /* time/year */
- // there is exacly 1 space between filename and previous token in all
- // outputs except old Hellsoft
- if (!is_old_Hellsoft)
- result->fe_fname = tokens[tokmarker+3] + toklen[tokmarker+3] + 1;
- else
- result->fe_fname = tokens[tokmarker+4];
+ // The length of the whole date string should be 12. On AIX the length
+ // is only 11 when the year is present in the date string and there is
+ // 1 padding space at the end of the string. In both cases the filename
+ // starts at offset 13 from the start of the date string.
+ // Don't care about leading spaces when the date string has different
+ // format or when old Hellsoft output was detected.
+ {
+ const char *date_start = tokens[tokmarker+1];
+ const char *date_end = tokens[tokmarker+3] + toklen[tokmarker+3];
+ if (!is_old_Hellsoft && ((date_end - date_start) == 12 ||
+ ((date_end - date_start) == 11 && date_end[1] == ' ')))
+ result->fe_fname = date_start + 13;
+ else
+ result->fe_fname = tokens[tokmarker+4];
+ }
result->fe_fnlen = (&(line[linelen]))
- (result->fe_fname);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]