[BusyBox] bug#1112: ls -A option automatically invoked for root

David Douthitt ssrat at mailbag.com
Thu Mar 1 17:31:06 UTC 2001


Package: busybox
Version: 0.50pre

In recent days, I've heard recommendations for root to get in habit of
using "ls -a" to list files.  Then I noticed that ls under HP-UX uses
the -A option automatically for root.

This patch implements this for busybox...
-------------- next part --------------
--- ls.c.orig	Thu Mar  1 10:07:32 2001
+++ ls.c	Thu Mar  1 11:08:52 2001
@@ -836,6 +836,13 @@
 		}
 	}
 
+	if ((geteuid()) == 0) {
+
+		/* equivalent to 'A' option automatically set for root */
+
+		disp_opts |= DISP_HIDDEN;
+	}
+
 	/* sort out which command line options take precedence */
 #ifdef BB_FEATURE_LS_RECURSIVE
 	if (disp_opts & DISP_NOLIST)


More information about the busybox mailing list