Compare commits

..

No commits in common. "2fbc6105d73fe9550f8a7d1f36e5db80a17a1531" and "43f90c4f88003706b4a0913ca104f9c75005794b" have entirely different histories.

4 changed files with 4 additions and 6 deletions

View File

@ -8,8 +8,8 @@
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
StringView pathname; StringView pathname;
bool show_all { false }; bool show_all;
bool show_almost_all { false }; bool show_almost_all;
ArgumentParser parser; ArgumentParser parser;
parser.add_positional_argument(pathname, "directory"_sv, "/"_sv); parser.add_positional_argument(pathname, "directory"_sv, "/"_sv);

View File

@ -44,8 +44,6 @@ Result<u64> sys_open(Registers*, SyscallArgs args)
if ((flags & O_WRONLY) && (inode->mode() & S_IWUSR) == 0) return err(EACCES); if ((flags & O_WRONLY) && (inode->mode() & S_IWUSR) == 0) return err(EACCES);
} }
if(inode->type() != VFS::InodeType::Directory && (flags & O_DIRECTORY)) return err(ENOTDIR);
if ((flags & O_WRONLY) && (flags & O_TRUNC)) inode->truncate(0); if ((flags & O_WRONLY) && (flags & O_TRUNC)) inode->truncate(0);
int fd = TRY(current->allocate_fd(0)); int fd = TRY(current->allocate_fd(0));

View File

@ -12,7 +12,6 @@
#define O_TRUNC 32 #define O_TRUNC 32
#define O_NONBLOCK 64 #define O_NONBLOCK 64
#define O_CLOEXEC 128 #define O_CLOEXEC 128
#define O_DIRECTORY 256
#define O_ACCMODE O_RDWR #define O_ACCMODE O_RDWR

View File

@ -13,7 +13,8 @@ extern "C"
DIR* dp = (DIR*)malloc(sizeof(DIR)); DIR* dp = (DIR*)malloc(sizeof(DIR));
if (!dp) { return nullptr; } if (!dp) { return nullptr; }
int fd = open(path, O_RDONLY | O_DIRECTORY); // FIXME: Use O_DIRECTORY (validate that path is actually a directory)
int fd = open(path, O_RDONLY);
if (fd < 0) if (fd < 0)
{ {
free(dp); free(dp);