[PATCH] ftpfs date/time parsing bug



Hi,

here is a small fix for $subj. It's triggered by something like this

lftp holly:/pub/Video/Farscape/Farscape2> ls
-rw-r--r-- 1 1000 henry 341626880 Jan 21 2002 2x00 - Reunion (originally meant to be 2x01).avi -rw-r--r-- 1 1000 henry 340867072 Jan 17 2002 2x01 - Mind the Baby.avi -rw-r--r-- 1 1000 henry 341501952 Jan 18 2002 2x02 - Vitas Mortis.avi -rw-r--r-- 1 1000 henry 340209664 Jan 18 2002 2x03 - Taking the Stone.avi -rw-r--r-- 1 1000 henry 341143552 Jan 18 2002 2x04 - Crackers Don't Matter.avi

i.e. date in "month day year" format followed by a filename starting with a number. Then the number is treated as a part of the date, resulting in a filename like " - Crackers Don't Matter.avi".

Regards,

--
Jindrich Makovicka

--- orig/vfs.c	Fri Aug 16 05:05:25 2002
+++ vfs.c	Tue Sep 24 16:47:29 2002
@@ -1665,9 +1665,13 @@
 	    idx++;
 
 	/* This is a special case for ctime() or Mon DD YYYY hh:mm */
-	if(is_num (idx) && (columns[idx+1][0]) &&
-	    ((got_year |= is_year(columns[idx], &tim)) || is_time(columns[idx], &tim)))
-		idx++; /* time & year or reverse */
+	    if(is_num (idx) && (columns[idx+1][0])) {
+		if (got_year) {
+		    if (is_time(columns[idx], &tim)) idx++; /* time also */
+		} else {
+		    if (got_year |= is_year(columns[idx], &tim)) idx++; /* year also */
+		}
+	    }
 	} /* only time or date */
     }
     else 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]