1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:28:12 +00:00

Add some basic field width support to printf().

Use it to make "ls" output a bit better. Also sys$spawn now fails with EACCES
if the path is not a file that's executable by the current uid/gid.
This commit is contained in:
Andreas Kling 2018-10-27 16:43:03 +02:00
parent de2fb183cc
commit 8f91a47aeb
8 changed files with 212 additions and 272 deletions

View file

@ -17,6 +17,15 @@ inline bool isSetGID(Unix::mode_t mode) { return mode & 02000; }
struct InodeMetadata {
bool isValid() const { return inode.isValid(); }
bool mayExecute(uid_t u, gid_t g) const
{
if (uid == u)
return mode & 0100;
if (gid == g)
return mode & 0010;
return mode & 0001;
}
bool isDirectory() const { return ::isDirectory(mode); }
bool isCharacterDevice() const { return ::isCharacterDevice(mode); }
bool isBlockDevice() const { return ::isBlockDevice(mode); }