diff options
author | Mark Whitley <markw@lineo.com> | 2001-04-30 18:17:00 +0000 |
---|---|---|
committer | Mark Whitley <markw@lineo.com> | 2001-04-30 18:17:00 +0000 |
commit | 8a633268ef478a31bd649d582ce07e9c26a4a03a (patch) | |
tree | a90a2bc3c3815f7f0e70f009b9b175736902a848 /coreutils | |
parent | 6f343944548c2e41fde4a376e805bf322a8e01c9 (diff) | |
download | busybox-8a633268ef478a31bd649d582ce07e9c26a4a03a.tar.gz |
Made new xreadlink function for libbb and changed applets to use it instead of
readlink(2).
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/ls.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/coreutils/ls.c b/coreutils/ls.c index d24ba9866..c13b225fa 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c @@ -577,7 +577,7 @@ static struct dnode **list_dir(char *path) /*----------------------------------------------------------------------*/ static int list_single(struct dnode *dn) { - int i, len; + int i; char scratch[BUFSIZ + 1]; #ifdef BB_FEATURE_LS_TIMESTAMPS char *filetime; @@ -688,16 +688,16 @@ static int list_single(struct dnode *dn) break; case LIST_SYMLINK: if (S_ISLNK(dn->dstat.st_mode)) { - len= readlink(dn->fullname, scratch, (sizeof scratch)-1); - if (len > 0) { - scratch[len]= '\0'; - printf(" -> %s", scratch); + char *lpath = xreadlink(dn->fullname); + if (lpath) { + printf(" -> %s", lpath); #ifdef BB_FEATURE_LS_FILETYPES if (!stat(dn->fullname, &info)) { append = append_char(info.st_mode); } #endif - column += len+4; + column += strlen(lpath) + 4; + free(lpath); } } break; |