diff options
author | Sol Jerome <solj@ices.utexas.edu> | 2009-01-29 21:36:46 +0000 |
---|---|---|
committer | Sol Jerome <solj@ices.utexas.edu> | 2009-01-29 21:36:46 +0000 |
commit | 8c2821c5134f5dfc7f78183793fcb8c1b4d92e00 (patch) | |
tree | 5efbf6fcb9a507133d842de4638f1b873822bf93 /src/lib/Client | |
parent | 4d1544016635254d1c51ec77e3e26699d64b1d26 (diff) | |
download | bcfg2-8c2821c5134f5dfc7f78183793fcb8c1b4d92e00.tar.gz bcfg2-8c2821c5134f5dfc7f78183793fcb8c1b4d92e00.tar.bz2 bcfg2-8c2821c5134f5dfc7f78183793fcb8c1b4d92e00.zip |
Use safer alternatives to mktemp (Patch from adeason)
Signed-off-by: Sol Jerome <solj@ices.utexas.edu>
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5049 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Client')
-rw-r--r-- | src/lib/Client/Tools/Blast.py | 5 | ||||
-rw-r--r-- | src/lib/Client/Tools/SYSV.py | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/lib/Client/Tools/Blast.py b/src/lib/Client/Tools/Blast.py index 6eb330c60..cd926accd 100644 --- a/src/lib/Client/Tools/Blast.py +++ b/src/lib/Client/Tools/Blast.py @@ -16,9 +16,10 @@ class Blast(Bcfg2.Client.Tools.SYSV.SYSV): def __init__(self, logger, setup, config): # dont use the sysv constructor Bcfg2.Client.Tools.PkgTool.__init__(self, logger, setup, config) - self.noaskname = tempfile.mktemp() + noaskfile = tempfile.NamedTemporaryFile() + self.noaskname = noaskfile.name try: - open(self.noaskname, 'w+').write(Bcfg2.Client.Tools.SYSV.noask) + noaskfile.write(Bcfg2.Client.Tools.SYSV.noask) except: pass diff --git a/src/lib/Client/Tools/SYSV.py b/src/lib/Client/Tools/SYSV.py index 22acb91ad..23875d4f9 100644 --- a/src/lib/Client/Tools/SYSV.py +++ b/src/lib/Client/Tools/SYSV.py @@ -31,9 +31,10 @@ class SYSV(Bcfg2.Client.Tools.PkgTool): def __init__(self, logger, setup, config): Bcfg2.Client.Tools.PkgTool.__init__(self, logger, setup, config) - self.noaskname = tempfile.mktemp() + noaskfile = tempfile.NamedTemporaryFile() + self.noaskname = noaskfile.name try: - open(self.noaskname, 'w+').write(noask) + noaskfile.write(noask) self.pkgtool = (self.pkgtool[0] % ("-a %s" % (self.noaskname)), \ self.pkgtool[1]) except: |