From c7953da22dea1ac96234f0a9682a307a74ae4e85 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Sun, 31 Aug 2014 13:46:34 +0000 Subject: [PATCH] * getfacl.c (usage): Add flags description. (main): Print suid/sgid/vtx flags if available. --- winsup/utils/ChangeLog | 5 +++++ winsup/utils/getfacl.c | 10 ++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog index 6289c27f9..932972684 100644 --- a/winsup/utils/ChangeLog +++ b/winsup/utils/ChangeLog @@ -1,3 +1,8 @@ +2014-08-31 Corinna Vinschen + + * getfacl.c (usage): Add flags description. + (main): Print suid/sgid/vtx flags if available. + 2014-08-15 Corinna Vinschen * configure.ac: Convert to new AC_INIT style. diff --git a/winsup/utils/getfacl.c b/winsup/utils/getfacl.c index cbde4668a..ed1adfce7 100644 --- a/winsup/utils/getfacl.c +++ b/winsup/utils/getfacl.c @@ -1,6 +1,6 @@ /* getfacl.c - Copyright 2000, 2001, 2002, 2003, 2004, 2009, 2011 Red Hat Inc. + Copyright 2000, 2001, 2002, 2003, 2004, 2009, 2011, 2014 Red Hat Inc. Written by Corinna Vinschen @@ -87,13 +87,15 @@ usage (FILE * stream) "For directories getfacl displays additionally the default ACL.\n" "\n" "With no options specified, getfacl displays the filename, the\n" - "owner, the group, and both the ACL and the default ACL, if it\n" + "owner, the group, the setuid (s), setgid (s), and sticky (t)\n" + "bits if available, and both the ACL and the default ACL, if it\n" "exists.\n" "\n" "The format for ACL output is as follows:\n" " # file: filename\n" " # owner: name or uid\n" " # group: name or uid\n" + " # flags: sst\n" " user::perm\n" " user:name or uid:perm\n" " group::perm\n" @@ -196,6 +198,10 @@ main (int argc, char **argv) printf ("# owner: %s\n", username (st.st_uid)); printf ("# group: %s\n", groupname (st.st_gid)); } + if (st.st_mode & (S_ISUID | S_ISGID | S_ISVTX)) + printf ("# flags: %c%c%c\n", (st.st_mode & S_ISUID) ? 's' : '-', + (st.st_mode & S_ISGID) ? 's' : '-', + (st.st_mode & S_ISVTX) ? 't' : '-'); for (i = 0; i < num_acls; ++i) { if (acls[i].a_type & ACL_DEFAULT)