summaryrefslogtreecommitdiffstats
path: root/xlators/mount/fuse/src
diff options
context:
space:
mode:
authorVikas Gorur <vikas@gluster.com>2010-01-25 07:02:45 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-01-25 04:35:34 -0800
commit6041019b63cef990d9892ea2a1cfe219166509df (patch)
tree7b6c6dc6d72296d8e7d963a122198841e05bf76f /xlators/mount/fuse/src
parent7b12c4eb7e20251b9b128e905518478df25d2af2 (diff)
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 <vikas@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 571 (find -type l ignores symlinks on GlusterFS) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=571
Diffstat (limited to 'xlators/mount/fuse/src')
-rw-r--r--xlators/mount/fuse/src/fuse-bridge.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index 8843afb38fe..a51cf6eed98 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;
}