path: root/testing/idris2/0002-Better-default-permissions-for-created-directories.patch
blob: af4c5f6a045dff710d258d095e284ba7ce5cc581 (plain) (tree)

From 2c7f7bc4fb871e32e0e44b3b625464598130fc5c Mon Sep 17 00:00:00 2001
From: Johann Rudloff <johann@sinyax.net>
Date: Sun, 10 Jan 2021 12:54:15 +0100
Subject: [PATCH] Better default permissions for created directories

Change the support code for directory creation so that it sets all
permission bits (ugo=rwx). The process's currently active umask will be
subtracted from these permissions, which leads to the result that (for a
standard umask of "022") directories are created with a mode of "0755".

So by default, directories created with `prim__createDir` are now also
group-executable and other-executable by default.

Previous behaviour was to create the directories readable for group and
other, but not executable (mode "744"), and thus inaccessible to anyone
except the owner.
 support/c/idris_directory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/support/c/idris_directory.c b/support/c/idris_directory.c
index 2f7d735a..0c9dbfe2 100644
--- a/support/c/idris_directory.c
+++ b/support/c/idris_directory.c
@@ -19,7 +19,7 @@ int idris2_createDir(char* dir) {
 #ifdef _WIN32
     return mkdir(dir);
-    return mkdir(dir, S_IRWXU | S_IRGRP | S_IROTH);
+    return mkdir(dir, S_IRWXU | S_IRWXG | S_IRWXO);