diff --git a/lsflib/src/getdir.c b/lsflib/src/getdir.c --- a/lsflib/src/getdir.c +++ b/lsflib/src/getdir.c @@ -17,7 +17,7 @@ { struct stat buf; - if (!stat (filename, &buf)) + if (!lstat (filename, &buf)) return (S_ISDIR (buf.st_mode)); return 0; @@ -27,12 +27,22 @@ { struct stat buf; - if (!stat (filename, &buf)) + if (!lstat (filename, &buf)) return (S_ISREG (buf.st_mode)); return 0; } +int isLink (char *filename) +{ + struct stat buf; + + if (!lstat (filename, &buf)) + return (S_ISLNK (buf.st_mode)); + + return 0; +} + void getdir (char *root, int recursive) { struct dirent *entry;