summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/adfs/dir.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/fs/adfs/dir.c b/fs/adfs/dir.c
index 51ed80ff10a5..fe39310c1a0a 100644
--- a/fs/adfs/dir.c
+++ b/fs/adfs/dir.c
@@ -18,18 +18,25 @@ static DEFINE_RWLOCK(adfs_dir_lock);
18 18
19void adfs_object_fixup(struct adfs_dir *dir, struct object_info *obj) 19void adfs_object_fixup(struct adfs_dir *dir, struct object_info *obj)
20{ 20{
21 unsigned int i; 21 unsigned int dots, i;
22 22
23 /* 23 /*
24 * RISC OS allows the use of '/' in directory entry names, so we need 24 * RISC OS allows the use of '/' in directory entry names, so we need
25 * to fix these up. '/' is typically used for FAT compatibility to 25 * to fix these up. '/' is typically used for FAT compatibility to
26 * represent '.', so do the same conversion here. In any case, '.' 26 * represent '.', so do the same conversion here. In any case, '.'
27 * will never be in a RISC OS name since it is used as the pathname 27 * will never be in a RISC OS name since it is used as the pathname
28 * separator. 28 * separator. Handle the case where we may generate a '.' or '..'
29 * name, replacing the first character with '^' (the RISC OS "parent
30 * directory" character.)
29 */ 31 */
30 for (i = 0; i < obj->name_len; i++) 32 for (i = dots = 0; i < obj->name_len; i++)
31 if (obj->name[i] == '/') 33 if (obj->name[i] == '/') {
32 obj->name[i] = '.'; 34 obj->name[i] = '.';
35 dots++;
36 }
37
38 if (obj->name_len <= 2 && dots == obj->name_len)
39 obj->name[0] = '^';
33 40
34 obj->filetype = -1; 41 obj->filetype = -1;
35 42