lkml.org 
[lkml]   [2003]   [Dec]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 2.4.23, 2.6.0-test11] fix d_type in readdir in isofs
On Tuesday 09 of December 2003 11:09, viro@parcelfarce.linux.theplanet.co.uk 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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:59    [W:0.031 / U:0.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site