Commit 1eec76d0 authored by Kirill Smelkov's avatar Kirill Smelkov

X wcfs: try to set sticky for /tmp/wcfs even if the directory already exists

This should cure the situation when on testnodes /tmp/wcfs already exists
created without sticky bit.
parent a7138fef
......@@ -295,10 +295,20 @@ def _wcfs_exe():
def _mntpt_4zurl(zurl):
m = hashlib.sha1()
m.update(zurl)
# mkdir /tmp/wcfs with stiky bit. This way multiple users can create subdirectories inside.
wcfsroot = "%s/wcfs" % (tempfile.gettempdir())
wcfsmode = 0777 | stat.S_ISVTX
if _mkdir_p(wcfsroot):
os.chmod(wcfsroot, 0777 | stat.S_ISVTX)
os.chmod(wcfsroot, wcfsmode)
else:
# migration workaround for the situation when /tmp/wcfs was created by
# code that did not yet set sticky bit.
_ = os.stat(wcfsroot)
if _.st_uid == os.getuid():
if _.st_mode != wcfsmode:
os.chmod(wcfsroot, wcfsmode)
mntpt = "%s/%s" % (wcfsroot, m.hexdigest())
_mkdir_p(mntpt)
return mntpt
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment