udf: Treat symlink component of type 2 as /
authorJan Kara <jack@suse.cz>
Mon, 12 Dec 2011 14:13:50 +0000 (15:13 +0100)
committerJan Kara <jack@suse.cz>
Mon, 9 Jan 2012 12:52:08 +0000 (13:52 +0100)
Currently, we ignore symlink component of type 2. But mkisofs and other OS'
seem to treat it as / so do the same for compatibility.

Reported-by: "Gábor S." <otnaccess@hotmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
fs/udf/symlink.c

index b1d4488b0f14ad3aad14aeb519877bc38f1f209a..d7c6dbe4194bb33bbe37930c63cf23377e5d9343 100644 (file)
@@ -41,10 +41,16 @@ static void udf_pc_to_char(struct super_block *sb, unsigned char *from,
                pc = (struct pathComponent *)(from + elen);
                switch (pc->componentType) {
                case 1:
-                       if (pc->lengthComponentIdent == 0) {
-                               p = to;
-                               *p++ = '/';
-                       }
+                       /*
+                        * Symlink points to some place which should be agreed
+                        * upon between originator and receiver of the media. Ignore.
+                        */
+                       if (pc->lengthComponentIdent > 0)
+                               break;
+                       /* Fall through */
+               case 2:
+                       p = to;
+                       *p++ = '/';
                        break;
                case 3:
                        memcpy(p, "../", 3);