hplip/hplip-no-root-config.patch

31 lines
1.1 KiB
Diff

diff -up hplip-2.8.12/base/g.py.no-root-config hplip-2.8.12/base/g.py
--- hplip-2.8.12/base/g.py.no-root-config 2008-12-17 20:41:12.000000000 +0000
+++ hplip-2.8.12/base/g.py 2009-01-12 12:22:31.000000000 +0000
@@ -91,6 +91,15 @@ class ConfigSection(dict):
self.config_obj.set(self.section_name, option, val)
+ 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
+
try:
f = file(self.filename, 'w')
self.config_obj.write(f)
@@ -107,6 +116,10 @@ class Config(dict):
log.debug("Reading config file %s" % filename)
+ if filename.startswith ("/root/") or filename.startswith ("/var/"):
+ # Don't try opening a file in root's home directory.
+ return
+
try:
f = file(filename, 'r')
self.config_obj.readfp(f)