summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2009-09-11 16:30:27 +0200
committerJim Meyering <meyering@redhat.com>2009-09-11 19:58:18 +0200
commitebbf0a1f0f75490dd7e8b7d717adc46888075e1e (patch)
tree3b185b3c1770a50ba7de5b169ed3bed7abe3fa0b /src
parent398749b0cc49773320e6bc56eafabe7e85437412 (diff)
downloadcoreutils-ebbf0a1f0f75490dd7e8b7d717adc46888075e1e.tar.xz
id: don't print context=... when POSIXLY_CORRECT is set
* src/id.c (print_full_info) [POSIXLY_CORRECT]: Don't print context. Reported by Ulrich Drepper. * NEWS (Changes in behavior): Mention it. * doc/coreutils.texi (id invocation): Document that id also prints the security context, when possible, and when POSIXLY_CORRECT is not set. * tests/id/no-context: New file. Test for this. * tests/Makefile.am (TESTS): Add it.
Diffstat (limited to 'src')
-rw-r--r--src/id.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/id.c b/src/id.c
index b28643b18..ec255e2f8 100644
--- a/src/id.c
+++ b/src/id.c
@@ -328,6 +328,9 @@ print_full_info (const char *username)
free (groups);
}
#endif /* HAVE_GETGROUPS */
- if (context != NULL)
+
+ /* POSIX mandates the precise output format, and that it not include
+ any context=... part, so skip that if POSIXLY_CORRECT is set. */
+ if (context != NULL && ! getenv ("POSIXLY_CORRECT"))
printf (_(" context=%s"), context);
}