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
This commit is contained in:
parent
7b12c4eb7e
commit
6041019b63
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user