diff options
author | Eric Andersen | 2000-10-09 17:51:25 +0000 |
---|---|---|
committer | Eric Andersen | 2000-10-09 17:51:25 +0000 |
commit | 958c78f9a10f2d4e58afa5700da098dfffa4279e (patch) | |
tree | 7b4551f795279bc25e2786f4774abb2191f1c37b | |
parent | 13241dfbdd5c39c18296e75df118860e330417dd (diff) | |
download | busybox-958c78f9a10f2d4e58afa5700da098dfffa4279e.zip busybox-958c78f9a10f2d4e58afa5700da098dfffa4279e.tar.gz |
Apply a patch from Matt Kraai:
"The -L option to ls doesn't behave correctly for files listed explicitly
on the command line, only those in directories that are listed. The
appended patch fixes this problem. Would someone please commit it?"
-Erik
-rw-r--r-- | coreutils/ls.c | 12 | ||||
-rw-r--r-- | ls.c | 12 |
2 files changed, 22 insertions, 2 deletions
diff --git a/coreutils/ls.c b/coreutils/ls.c index 385d6b2..8d975fd 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c @@ -790,7 +790,17 @@ extern int ls_main(int argc, char **argv) for (oi=0 ; oi < ac; oi++) { cur= (struct dnode *)xmalloc(sizeof(struct dnode)); cur->fullname= xstrdup(av[oi]); - cur->name= cur->fullname ; + cur->name= cur->fullname; +#ifdef BB_FEATURE_LS_FOLLOWLINKS + if (follow_links == TRUE) { + if (stat(av[oi], &cur->dstat)) { + errorMsg("%s: %s\n", av[oi], strerror(errno)); + free(cur->fullname); + free(cur); + continue; + } + } else +#endif if (lstat(av[oi], &cur->dstat)) { /* get file info into node */ errorMsg("%s: %s\n", av[oi], strerror(errno)); free(cur->fullname); @@ -790,7 +790,17 @@ extern int ls_main(int argc, char **argv) for (oi=0 ; oi < ac; oi++) { cur= (struct dnode *)xmalloc(sizeof(struct dnode)); cur->fullname= xstrdup(av[oi]); - cur->name= cur->fullname ; + cur->name= cur->fullname; +#ifdef BB_FEATURE_LS_FOLLOWLINKS + if (follow_links == TRUE) { + if (stat(av[oi], &cur->dstat)) { + errorMsg("%s: %s\n", av[oi], strerror(errno)); + free(cur->fullname); + free(cur); + continue; + } + } else +#endif if (lstat(av[oi], &cur->dstat)) { /* get file info into node */ errorMsg("%s: %s\n", av[oi], strerror(errno)); free(cur->fullname); |