Re: [PATCH 2.4.23, 2.6.0-test11] fix d_type in readdir in isofs

From: Domen Puncer
Date: Tue Dec 09 2003 - 08:49:57 EST


On Tuesday 09 of December 2003 11:09, viro@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx wrote:
> On Tue, Dec 09, 2003 at 10:47:32AM +0100, Domen Puncer wrote:
> > Hi!
> >
> > Played with scandir, and noticed iso9660's files d_type is always 0,
> > so here's a fix.
>
> No, it isn't. DT_UNKNOWN is "I don't know; make no assumptions".
> DT_REG is "regular file". Returning it when object in question is
> e.g. a symlink is wrong.

Right, then how about this partial fix:
--- c/fs/isofs/dir.c 2003-08-23 01:58:53.000000000 +0200
+++ a/fs/isofs/dir.c 2003-12-09 14:37:45.000000000 +0100
@@ -230,7 +230,8 @@
}
}
if (len > 0) {
- if (filldir(dirent, p, len, filp->f_pos, inode_number, DT_UNKNOWN) < 0)
+ if (filldir(dirent, p, len, filp->f_pos, inode_number,
+ (de->flags[0]&2)?DT_DIR:DT_UNKNOWN) < 0)
break;
}
filp->f_pos += de_len;


Or maybe we should read inode->i_mode, if it's not too time expensive?

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/