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/sbin | |
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/sbin')
-rwxr-xr-x | src/sbin/bcfg2 | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/sbin/bcfg2 b/src/sbin/bcfg2 index 0a4092b7f..039f5387a 100755 --- a/src/sbin/bcfg2 +++ b/src/sbin/bcfg2 @@ -166,12 +166,14 @@ class Client: self.logger.info("Running probe %s" % name) ret = Bcfg2.Client.XML.Element("probe-data", name=name, source=probe.get('source')) try: - script = open(tempfile.mktemp(), 'w+') + scripthandle, scriptname = tempfile.mkstemp() + script = open(scriptname, 'w+') try: script.write("#!%s\n" % (probe.attrib.get('interpreter', '/bin/sh'))) script.write(probe.text) script.close() + os.close(scripthandle) os.chmod(script.name, 0755) ret.text = os.popen(script.name).read().strip() self.logger.info("Probe %s has result:\n%s" % (name, ret.text)) |