git://git.onelab.eu
/
pyplnet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
os.tmpnam is unsafe.
[pyplnet.git]
/
modprobe.py
diff --git
a/modprobe.py
b/modprobe.py
index
d7fa2e3
..
638ebfa
100644
(file)
--- a/
modprobe.py
+++ b/
modprobe.py
@@
-5,6
+5,7
@@
"""Modprobe is a utility to read/modify/write /etc/modprobe.conf"""
import os
"""Modprobe is a utility to read/modify/write /etc/modprobe.conf"""
import os
+import tempfile
class Modprobe():
def __init__(self,filename="/etc/modprobe.conf"):
class Modprobe():
def __init__(self,filename="/etc/modprobe.conf"):
@@
-80,8
+81,8
@@
class Modprobe():
return False
def output(self,filename="/etc/modprobe.conf",program="NodeManager"):
return False
def output(self,filename="/etc/modprobe.conf",program="NodeManager"):
-
tmpnam = os.tmpnam(
)
- fb =
file(tmpnam,
"w")
+
(fd, tmpnam) = tempfile.mkstemp(dir=os.path.dirname(filename)
)
+ fb =
os.fdopen(fd,
"w")
fb.write("# Written out by %s\n" % program)
for command in ("alias","options","install","remove","blacklist"):
fb.write("# Written out by %s\n" % program)
for command in ("alias","options","install","remove","blacklist"):