fix for busybox ls to show symlinks in all cases
Apply the following patch to fix problem with ls not displaying symlinks.
readlink() need to be called with the full pathname otherwise is does not find
files outside the current directory.
Sorry I just have email access for the moment, so I cannot commit it myself to
CVS. Could someone do it for me?
Regards.
--- ls.c.orig Fri Oct 22 19:42:22 1999
+++ ls.c Sat Nov 6 23:47:59 1999
@@ -206,7 +206,7 @@
**
**/
-static void list_single(const char *name, struct stat *info)
+static void list_single(const char *name, struct stat *info, const char *fullname)
{
char scratch[PATH_MAX];
short len = strlen(name);
@@ -297,12 +297,12 @@
wr(name, len);
if (S_ISLNK(mode)) {
wr(" -> ", 4);
- len = readlink(name, scratch, sizeof scratch);
+ len = readlink(fullname, scratch, sizeof scratch);
if (len > 0) fwrite(scratch, 1, len, stdout);
#ifdef FEATURE_FILETYPECHAR
/* show type of destination */
if (opts & DISP_FTYPE) {
- if (!stat(name, info)) {
+ if (!stat(fullname, info)) {
append = append_char(info->st_mode);
if (append)
fputc(append, stdout);
@@ -372,7 +372,7 @@
if (!S_ISDIR(info.st_mode) ||
(opts & DIR_NOLIST)) {
- list_single(name, &info);
+ list_single(name, &info, name);
return 0;
}
@@ -424,7 +424,7 @@
strcpy(fnend, entry->d_name);
if (lstat(fullname, &info))
goto direrr; /* (shouldn't fail) */
- list_single(entry->d_name, &info);
+ list_single(entry->d_name, &info, fullname);
}
closedir(dir);
return 0;
--
Eric Delaunay | "La guerre justifie l'existence des militaires.
delaunay@lix.polytechnique.fr | En les supprimant." Henri Jeanson (1900-1970)
Reply to: