[PATCH] ls.c: option -i: don't follow symlink by default
Martijn Dekker
martijn at inlv.org
Sat Dec 29 21:36:18 UTC 2018
Op 19-12-18 om 21:30 schreef Martijn Dekker:
> When listing a symbolic link, the busybox 'ls -id' command incorrectly
> lists the inode of the link referred to by the symlink, rather than the
> inode of the symlink itself. The -d option is supposed to disable
> dereferencing of symbolic links[*].
'-d' is actually irrelevant (unless the operand is a symlink to a
directory).
The fix is to treat the 'i' option the same way that '-l', '-s' and '-F'
are already treated.
- M.
-------------- next part --------------
coreutils/ls.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/coreutils/ls.c b/coreutils/ls.c
index db3ddb944..b2adb0c06 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -1204,8 +1204,8 @@ int ls_main(int argc UNUSED_PARAM, char **argv)
nfiles = 0;
do {
cur = my_stat(*argv, *argv,
- /* follow links on command line unless -l, -s or -F: */
- !(option_mask32 & (OPT_l|OPT_s|OPT_F))
+ /* follow links on command line unless -l, -i, -s or -F: */
+ !(option_mask32 & (OPT_l|OPT_i|OPT_s|OPT_F))
/* ... or if -H: */
|| (option_mask32 & OPT_H)
/* ... or if -L, but my_stat always follows links if -L */
More information about the busybox
mailing list