login

<     >

2015-03-30 12:33:18 (UTC-03:00)

Marcel Rodrigues <marcelgmr@gmail.com>

Use lstat() to get correct size of symlinks.

diff --git a/rover.c b/rover.c
index 834c96a..280348b 100644
--- a/rover.c
+++ b/rover.c
@@ -367,8 +367,7 @@ ls(Row **rowsp, uint8_t flags)
             continue;
         if (!(flags & SHOW_HIDDEN) && ep->d_name[0] == '.')
             continue;
-        /* FIXME: POSIX < 200112L doesn't have lstat(). How do we handle symlinks? */
-        stat(ep->d_name, &statbuf);
+        lstat(ep->d_name, &statbuf);
         if (S_ISDIR(statbuf.st_mode)) {
             if (flags & SHOW_DIRS) {
                 rows[i].name = malloc(strlen(ep->d_name) + 2);