lsflib/src/getdir.c
changeset 150 75133486ba7e
parent 136 d82f65e902d0
child 158 2cddd4d26139
--- 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;