summaryrefslogtreecommitdiff
path: root/src/buildstream/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/buildstream/utils.py')
-rw-r--r--src/buildstream/utils.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/buildstream/utils.py b/src/buildstream/utils.py
index 181ea1df9..5bc1ce08f 100644
--- a/src/buildstream/utils.py
+++ b/src/buildstream/utils.py
@@ -65,6 +65,11 @@ _INITIAL_NUM_THREADS_IN_MAIN_PROCESS = 1
# Number of seconds to wait for background threads to exit.
_AWAIT_THREADS_TIMEOUT_SECONDS = 5
+# The process's file mode creation mask.
+# Impossible to retrieve without temporarily changing it on POSIX.
+_UMASK = os.umask(0o777)
+os.umask(_UMASK)
+
class UtilError(BstError):
"""Raised by utility functions when system calls fail.
@@ -638,6 +643,17 @@ def save_file_atomic(
raise
+# get_umask():
+#
+# Get the process's file mode creation mask without changing it.
+#
+# Returns:
+# (int) The process's file mode creation mask.
+#
+def get_umask():
+ return _UMASK
+
+
# _get_dir_size():
#
# Get the disk usage of a given directory in bytes.