hplip/hplip-no-root-config.patch

31 lines
1.2 KiB
Diff

diff -up hplip-3.9.2/base/g.py.no-root-config hplip-3.9.2/base/g.py
--- hplip-3.9.2/base/g.py.no-root-config 2009-02-20 00:36:51.000000000 +0000
+++ hplip-3.9.2/base/g.py 2009-02-20 11:13:28.000000000 +0000
@@ -110,6 +110,10 @@ class ConfigBase(object):
keys = options
def read(self):
+ if filename.startswith ("/root/") or filename.startswith ("/var/"):
+ # Don't try opening a file in root's home directory.
+ return
+
if self.filename is not None:
try:
fp = open(self.filename, "r")
@@ -119,6 +123,15 @@ class ConfigBase(object):
log.debug("Unable to open file %s for reading." % self.filename)
def write(self):
+ filename = self.filename
+ if filename.startswith ("/root/") or filename.startswith ("/var/"):
+ # Don't try writing a file in root's home directory.
+ return
+ elif filename.startswith ("/etc/"):
+ # Certainly don't try writing the system-wide config file!
+ # See bug #479178.
+ return
+
if self.filename is not None:
try:
fp = open(self.filename, "w")