2015-06-05 11:14:50 (UTC-03:00)
Marcel Rodrigues <marcelgmr@gmail.com>
Check whether symlink target is a directory. Previously we're using lstat() to make file sizes reflect the actual size occupied by an entry (symbolic links are just small references). However, we need to dereference links in order to know the correct type of their target.
diff --git a/rover.c b/rover.c index 54e68b7..7bed833 100644 --- a/rover.c +++ b/rover.c @@ -454,7 +454,7 @@ ls(Row **rowsp, uint8_t flags) continue; if (!(flags & SHOW_HIDDEN) && ep->d_name[0] == '.') continue; - lstat(ep->d_name, &statbuf); + stat(ep->d_name, &statbuf); if (S_ISDIR(statbuf.st_mode)) { if (flags & SHOW_DIRS) { rows[i].name = malloc(strlen(ep->d_name) + 2);