X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=modprobe.py;fp=modprobe.py;h=638ebfa388ae6e2654b2876b95961bc6dd1809d9;hb=bd8f483c4f4bc66f57ef201fc14510aacfde247c;hp=d7fa2e345a4488f4d0f5a6e6ffa800d0044c0c91;hpb=0a2d962b3b9c396f45b6ef3e1d435bb63b83a15d;p=pyplnet.git diff --git a/modprobe.py b/modprobe.py index d7fa2e3..638ebfa 100644 --- a/modprobe.py +++ b/modprobe.py @@ -5,6 +5,7 @@ """Modprobe is a utility to read/modify/write /etc/modprobe.conf""" import os +import tempfile 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"): - 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"):