diff options
author | Vikas Gorur <vikas@gluster.com> | 2010-01-25 07:02:45 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2010-01-26 03:46:26 -0800 |
commit | 5e1fdc783072337ab37876bfbbd4f3b2f56e6d7e (patch) | |
tree | f49f5b458fb7e05d9739f642f30922920f8b7e88 | |
parent | 404d4dadcea3893a86a405475acb32545598f0b5 (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
-rw-r--r-- | xlators/mount/fuse/src/fuse-bridge.c | 17 |
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; } |