From 6041019b63cef990d9892ea2a1cfe219166509df Mon Sep 17 00:00:00 2001 From: Vikas Gorur Date: Mon, 25 Jan 2010 07:02:45 +0000 Subject: mount/fuse: Fix file type checking. This patch fixes two things: - Check for symlinks and set d_type appropriately - Use S_IS* macros for checking. Signed-off-by: Vikas Gorur Signed-off-by: Anand V. Avati BUG: 571 (find -type l ignores symlinks on GlusterFS) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=571 --- xlators/mount/fuse/src/fuse-bridge.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'xlators/mount') diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index 8843afb38..a51cf6eed 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -2135,24 +2135,27 @@ d_type_from_stat (struct stat *buf) { unsigned char d_type; - if (buf->st_mode & S_IFREG) { - d_type = DT_REG; + if (S_ISLNK (buf->st_mode)) { + d_type = DT_LNK; - } else if (buf->st_mode & S_IFDIR) { + } else if (S_ISDIR (buf->st_mode)) { d_type = DT_DIR; - } else if (buf->st_mode & S_IFIFO) { + } else if (S_ISFIFO (buf->st_mode)) { d_type = DT_FIFO; - } else if (buf->st_mode & S_IFSOCK) { + } else if (S_ISSOCK (buf->st_mode)) { d_type = DT_SOCK; - } else if (buf->st_mode & S_IFCHR) { + } else if (S_ISCHR (buf->st_mode)) { d_type = DT_CHR; - } else if (buf->st_mode & S_IFBLK) { + } else if (S_ISBLK (buf->st_mode)) { d_type = DT_BLK; + } else if (S_ISREG (buf->st_mode)) { + d_type = DT_REG; + } else { d_type = DT_UNKNOWN; } -- cgit