diff options
Diffstat (limited to 'ls.c')
-rw-r--r-- | ls.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -577,7 +577,7 @@ static struct dnode **list_dir(char *path) | |||
577 | /*----------------------------------------------------------------------*/ | 577 | /*----------------------------------------------------------------------*/ |
578 | static int list_single(struct dnode *dn) | 578 | static int list_single(struct dnode *dn) |
579 | { | 579 | { |
580 | int i, len; | 580 | int i; |
581 | char scratch[BUFSIZ + 1]; | 581 | char scratch[BUFSIZ + 1]; |
582 | #ifdef BB_FEATURE_LS_TIMESTAMPS | 582 | #ifdef BB_FEATURE_LS_TIMESTAMPS |
583 | char *filetime; | 583 | char *filetime; |
@@ -688,16 +688,16 @@ static int list_single(struct dnode *dn) | |||
688 | break; | 688 | break; |
689 | case LIST_SYMLINK: | 689 | case LIST_SYMLINK: |
690 | if (S_ISLNK(dn->dstat.st_mode)) { | 690 | if (S_ISLNK(dn->dstat.st_mode)) { |
691 | len= readlink(dn->fullname, scratch, (sizeof scratch)-1); | 691 | char *lpath = xreadlink(dn->fullname); |
692 | if (len > 0) { | 692 | if (lpath) { |
693 | scratch[len]= '\0'; | 693 | printf(" -> %s", lpath); |
694 | printf(" -> %s", scratch); | ||
695 | #ifdef BB_FEATURE_LS_FILETYPES | 694 | #ifdef BB_FEATURE_LS_FILETYPES |
696 | if (!stat(dn->fullname, &info)) { | 695 | if (!stat(dn->fullname, &info)) { |
697 | append = append_char(info.st_mode); | 696 | append = append_char(info.st_mode); |
698 | } | 697 | } |
699 | #endif | 698 | #endif |
700 | column += len+4; | 699 | column += strlen(lpath) + 4; |
700 | free(lpath); | ||
701 | } | 701 | } |
702 | } | 702 | } |
703 | break; | 703 | break; |