Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save hgdeoro/1739239 to your computer and use it in GitHub Desktop.
Save hgdeoro/1739239 to your computer and use it in GitHub Desktop.
Use 'dir' instaead of 'prefix' when creating temporary files
diff --git a/source4/scripting/python/samba/netcmd/domain.py b/source4/scripting/python/samba/netcmd/domain.py
index 1e26850..176c461 100644
--- a/source4/scripting/python/samba/netcmd/domain.py
+++ b/source4/scripting/python/samba/netcmd/domain.py
@@ -848,9 +848,9 @@ class cmd_domain_samba3upgrade(Command):
eadb = False
elif use_xattrs == "auto" and not s3conf.get("posix:eadb"):
if targetdir:
- tmpfile = tempfile.NamedTemporaryFile(prefix=os.path.abspath(targetdir))
+ tmpfile = tempfile.NamedTemporaryFile(dir=os.path.abspath(targetdir))
else:
- tmpfile = tempfile.NamedTemporaryFile(prefix=os.path.abspath(os.path.dirname(lp.get("private dir"))))
+ tmpfile = tempfile.NamedTemporaryFile(dir=os.path.abspath(os.path.dirname(lp.get("private dir"))))
try:
samba.ntacls.setntacl(lp, tmpfile.name,
"O:S-1-5-32G:S-1-5-32", "S-1-5-32", "native")
diff --git a/source4/setup/provision b/source4/setup/provision
index be52854..8023705 100755
--- a/source4/setup/provision
+++ b/source4/setup/provision
@@ -223,9 +223,9 @@ if opts.use_xattrs == "yes":
eadb = False
elif opts.use_xattrs == "auto" and not lp.get("posix:eadb"):
if opts.targetdir:
- file = tempfile.NamedTemporaryFile(prefix=os.path.abspath(opts.targetdir))
+ file = tempfile.NamedTemporaryFile(dir=os.path.abspath(opts.targetdir))
else:
- file = tempfile.NamedTemporaryFile(prefix=os.path.abspath(os.path.dirname(lp.get("private dir"))))
+ file = tempfile.NamedTemporaryFile(dir=os.path.abspath(os.path.dirname(lp.get("private dir"))))
try:
samba.ntacls.setntacl(lp, file.name,
"O:S-1-5-32G:S-1-5-32", "S-1-5-32", "native")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment