ls: fix a performance regression
authorPádraig Brady <P@draigBrady.com>
Tue, 22 Sep 2009 09:06:49 +0000 (10:06 +0100)
committerPádraig Brady <P@draigBrady.com>
Tue, 22 Sep 2009 09:07:21 +0000 (10:07 +0100)
* src/ls.c (print_color_indicator): This reinstates commit f3f1ccfd,
21-10-2008, "ls: make it possible to disable file capabilities checking"
which was inadvertently reverted with commit 3a169f4c, 14-09-2009,
"ls: handle disabling of colors consistently ...".

src/ls.c

index 2fb5282..859d7c4 100644 (file)
--- a/src/ls.c
+++ b/src/ls.c
@@ -4126,7 +4126,8 @@ print_color_indicator (const char *name, mode_t mode, int linkok,
             type = C_SETUID;
           else if ((mode & S_ISGID) != 0 && is_colored (C_SETGID))
             type = C_SETGID;
-          else if (has_capability (name) && is_colored (C_CAP))
+          /* has_capability() called second for performance.  */
+          else if (is_colored (C_CAP) && has_capability (name))
             type = C_CAP;
           else if ((mode & S_IXUGO) != 0 && is_colored (C_EXEC))
             type = C_EXEC;