patch-2.1.77 linux/fs/vfat/namei.c

Next file: linux/include/asm-i386/processor.h
Previous file: linux/fs/proc/array.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.76/linux/fs/vfat/namei.c linux/fs/vfat/namei.c
@@ -173,6 +173,9 @@
 
 	len = qstr->len;
 	name = qstr->name;
+	while (len && name[len-1] == '.')
+		len--;
+
 	hash = init_name_hash();
 	while (len--) {
 		c = tolower(*name++);
@@ -193,14 +196,12 @@
 	/* A filename cannot end in '.' or we treat it like it has none */
 	alen = a->len;
 	blen = b->len;
-	if (alen != blen) {
-		if (a->name[alen-1] == '.')
-			alen--;
-		if (b->name[blen-1] == '.')
-			blen--;
-		if (alen != blen)
-			return 1;
-	}
+	while (alen && a->name[alen-1] == '.')
+		alen--;
+	while (blen && b->name[blen-1] == '.')
+		blen--;
+	if (alen != blen)
+		return 1;
 
 	return strnicmp(a->name, b->name, alen);
 }
@@ -966,11 +967,8 @@
 			  vf->name, vf->len, name, name_len);
 #endif
 
-	/* Filenames cannot end in '.' or we treat like it has none */
 	if (vf->len != name_len) {
-		if ((vf->len != name_len + 1) || (vf->name[name_len] != '.')) {
-			return 0;
-		}
+		return 0;
 	}
 
 	s1 = name; s2 = vf->name;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov