summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2010-10-05 08:40:17 +0100
committerPádraig Brady <P@draigBrady.com>2010-10-05 11:00:10 +0100
commit77063bf819f44bbae4dd057e75d23ee72c728a63 (patch)
tree67d746cf6aa8bf2866ace23206bdfca96ce5df16 /src
parent6ad89f223313920a4f752015cb76c9905c363179 (diff)
downloadcoreutils-77063bf819f44bbae4dd057e75d23ee72c728a63.tar.xz
stat: adjust the printing of SELinux context
* src/stat.c (default_format): Don't print SELinux context when in file system (-f) mode, as the context is associated with the file, not the file system. Fix logic inversion, so that in terse mode, %C is included only when is_selinux_enabled and not vice versa.
Diffstat (limited to 'src')
-rw-r--r--src/stat.c22
1 files changed, 3 insertions, 19 deletions
diff --git a/src/stat.c b/src/stat.c
index e13f21f22..f742f1ed3 100644
--- a/src/stat.c
+++ b/src/stat.c
@@ -1074,12 +1074,7 @@ default_format (bool fs, bool terse, bool device)
if (fs)
{
if (terse)
- {
- if (0 < is_selinux_enabled ())
- format = xstrdup ("%n %i %l %t %s %S %b %f %a %c %d %C\n");
- else
- format = xstrdup ("%n %i %l %t %s %S %b %f %a %c %d\n");
- }
+ format = xstrdup ("%n %i %l %t %s %S %b %f %a %c %d\n");
else
{
/* TRANSLATORS: This string uses format specifiers from
@@ -1091,17 +1086,6 @@ Block size: %-10s Fundamental block size: %S\n\
Blocks: Total: %-10b Free: %-10f Available: %a\n\
Inodes: Total: %-10c Free: %d\n\
"));
-
- if (0 < is_selinux_enabled ())
- {
- /* TRANSLATORS: This string uses format specifiers from
- 'stat --help' with --file-system, and NOT from printf. */
- char *temp = format;
- format = xasprintf ("%s%s", format, _("\
-Context: %C\n\
-"));
- free (temp);
- }
}
}
else /* ! fs */
@@ -1110,10 +1094,10 @@ Context: %C\n\
{
if (0 < is_selinux_enabled ())
format = xstrdup ("%n %s %b %f %u %g %D %i %h %t %T"
- " %X %Y %Z %W %o\n");
+ " %X %Y %Z %W %o %C\n");
else
format = xstrdup ("%n %s %b %f %u %g %D %i %h %t %T"
- " %X %Y %Z %W %o %C\n");
+ " %X %Y %Z %W %o\n");
}
else
{