diff options
author | Guilhem Moulin <guilhem@fripost.org> | 2025-04-28 17:40:39 +0200 |
---|---|---|
committer | Guilhem Moulin <guilhem@fripost.org> | 2025-04-28 18:12:14 +0200 |
commit | a06c77784468f071508ee432c0b0f6d58accbc21 (patch) | |
tree | 04fbc34ccf5116ba7fa8698b6f87c1fde7566895 /webmap-import | |
parent | ae4de42894153eba76a34e15df7582b2071e66a5 (diff) |
Set and restore umask to ensure lockfiles are atomically created with mode 0664.
Using the default 0022 yields lock files with g-w, so trying to flock(2)
from a different user failed.
Diffstat (limited to 'webmap-import')
-rwxr-xr-x | webmap-import | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/webmap-import b/webmap-import index 1d3f4ec..80f918e 100755 --- a/webmap-import +++ b/webmap-import @@ -518,6 +518,7 @@ def lockSourcePaths(layerdefs : dict[str,Any], lockdir: str) -> dict[str,int]: time) to reduce the time during which the sources prevented from being updated/downloaded, but their is some value in having consistency across the whole import process.""" + umask = os.umask(0o002) lockdir_fd = os.open(lockdir, O_RDONLY|O_CLOEXEC|O_PATH|O_DIRECTORY) try: ret = {} @@ -537,6 +538,7 @@ def lockSourcePaths(layerdefs : dict[str,Any], lockdir: str) -> dict[str,int]: os.close(lockdir_fd) except (OSError, ValueError): logging.exception('Could not close lockdir') + os.umask(umask) def releaseSourcePathLocks(lock_fds : dict[str,int]) -> None: """Release shared locks on the source paths. Closed FDs are removed from |