diff --git a/ext/extfs.cpp b/ext/extfs.cpp index b7fe6a42..90f298e2 100644 --- a/ext/extfs.cpp +++ b/ext/extfs.cpp @@ -96,12 +96,8 @@ mode_t HostModeFromExtMode(uint32_t extmode) { mode_t hostmode = extmode & 0777; if ( extmode & EXT2_S_ISVTX ) hostmode |= S_ISVTX; -#if defined(S_ISGID) // Not on Sortix. if ( extmode & EXT2_S_ISGID ) hostmode |= S_ISGID; -#endif -#if defined(S_ISUID) // Not on Sortix. if ( extmode & EXT2_S_ISUID ) hostmode |= S_ISUID; -#endif if ( EXT2_S_ISSOCK(extmode) ) hostmode |= S_IFSOCK; if ( EXT2_S_ISLNK(extmode) ) hostmode |= S_IFLNK; if ( EXT2_S_ISREG(extmode) ) hostmode |= S_IFREG; @@ -116,12 +112,8 @@ uint32_t ExtModeFromHostMode(mode_t hostmode) { uint32_t extmode = hostmode & 0777; if ( hostmode & S_ISVTX ) extmode |= EXT2_S_ISVTX; -#if defined(S_ISGID) // Not on Sortix. if ( hostmode & S_ISGID ) extmode |= EXT2_S_ISGID; -#endif -#if defined(S_ISUID) // Not on Sortix. - if ( hostmode & EXT2_S_ISUID ) extmode |= EXT2_S_ISUID; -#endif + if ( hostmode & S_ISUID ) extmode |= EXT2_S_ISUID; if ( S_ISSOCK(hostmode) ) extmode |= EXT2_S_IFSOCK; if ( S_ISLNK(hostmode) ) extmode |= EXT2_S_IFLNK; if ( S_ISREG(hostmode) ) extmode |= EXT2_S_IFREG; diff --git a/kernel/include/sortix/initrd.h b/kernel/include/sortix/initrd.h index 49ccc3f2..28a6068a 100644 --- a/kernel/include/sortix/initrd.h +++ b/kernel/include/sortix/initrd.h @@ -53,9 +53,8 @@ __BEGIN_DECLS #define INITRD_S_IFDIR 0x4000 #define INITRD_S_IFCHR 0x2000 #define INITRD_S_IFIFO 0x1000 -/* Intentionally not part of Sortix. */ -/*#define INITRD_S_ISUID 0x0800 */ -/*#define INITRD_S_ISGID 0x0400 */ +#define INITRD_S_ISUID 0x0800 +#define INITRD_S_ISGID 0x0400 #define INITRD_S_ISVTX 0x0200 #define INITRD_S_ISSOCK(mode) ((mode & INITRD_S_IFMT) == INITRD_S_IFSOCK) #define INITRD_S_ISLNK(mode) ((mode & INITRD_S_IFMT) == INITRD_S_IFLNK) diff --git a/kernel/include/sortix/stat.h b/kernel/include/sortix/stat.h index 7f3a753b..e77de5bb 100644 --- a/kernel/include/sortix/stat.h +++ b/kernel/include/sortix/stat.h @@ -1,6 +1,6 @@ /******************************************************************************* - Copyright(C) Jonas 'Sortie' Termansen 2012, 2013, 2014. + Copyright(C) Jonas 'Sortie' Termansen 2012, 2013, 2014, 2015. This file is part of Sortix. @@ -75,9 +75,8 @@ struct stat #define S_IFDIR __DTTOIF(__DT_DIR) #define S_IFCHR __DTTOIF(__DT_CHR) #define S_IFIFO __DTTOIF(__DT_FIFO) -/* Intentionally not part of Sortix. */ -/*#define S_ISUID 0x0800 */ -/*#define S_ISGID 0x0400 */ +#define S_ISUID 0x0800 +#define S_ISGID 0x0400 #define S_ISVTX 0x0200 #define S_SETABLE (0777 | 0x0200 | 0x0400 | 0x0800) #define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK) diff --git a/utils/ls.cpp b/utils/ls.cpp index b8c1e680..a8389e93 100644 --- a/utils/ls.cpp +++ b/utils/ls.cpp @@ -306,7 +306,6 @@ int handle_entry_internal(const char* fullpath, const char* name, unsigned char return 0; } char perms[11]; - perms[0] = '?'; switch ( type ) { case DT_UNKNOWN: perms[0] = '?'; break; @@ -325,6 +324,13 @@ int handle_entry_internal(const char* fullpath, const char* name, unsigned char bool set = st.st_mode & (1UL<