[PATCH 3/4] Make chmod and ls recognize sticky bit (S_ISVTX).

From: Markus Wichmann <nullplan_AT_gmx.net>
Date: Sun, 20 Oct 2013 10:53:43 +0200

---
 chmod.c | 4 ++--
 ls.c    | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/chmod.c b/chmod.c
index 1af3f45..74c8700 100644
--- a/chmod.c
+++ b/chmod.c
_AT_@ -31,9 +31,9 @@ main(int argc, char *argv[])
 			case 'R':
 				rflag = true;
 				break;
-			case 'r': case 'w': case 'x': case 's':
+                        case 'r': case 'w': case 'x': case 's': case 't':
 				/*
-				 * -[rwxs] are valid modes so do not interpret
+				 * -[rwxst] are valid modes so do not interpret
 				 * them as options - in any case we are done if
 				 * we hit this case
 				 */
diff --git a/ls.c b/ls.c
index af1336d..c5eae89 100644
--- a/ls.c
+++ b/ls.c
_AT_@ -228,6 +228,7 @@ output(Entry *ent)
 
 	if(ent->mode & S_ISUID) mode[3] = (mode[3] == 'x') ? 's' : 'S';
 	if(ent->mode & S_ISGID) mode[6] = (mode[6] == 'x') ? 's' : 'S';
+        if(ent->mode & S_ISVTX) mode[9] = (mode[9] == 'x') ? 't' : 'T';
 
 	errno = 0;
 	pw = getpwuid(ent->uid);
-- 
1.8.4.rc3
--LQksG6bCIzRHxTLp
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0004-Add-sticky-bit-to-documentation.patch"
Received on Mon Sep 17 2001 - 00:00:00 CEST

This archive was generated by hypermail 2.3.0 : Sun Oct 20 2013 - 11:48:02 CEST