pisi history command privilege warning

BUG:FIXED:8515
This commit is contained in:
Faik Uygur
2008-11-05 12:59:31 +00:00
parent 23de0097d6
commit 660b8bad56
2 changed files with 8 additions and 1 deletions
+5 -1
View File
@@ -54,7 +54,11 @@ def locked(func):
Decorator for synchronizing privileged functions Decorator for synchronizing privileged functions
""" """
def wrapper(*__args,**__kw): def wrapper(*__args,**__kw):
lock = file(pisi.util.join_path(pisi.context.config.lock_dir(), 'pisi'), 'w') try:
lock = file(pisi.util.join_path(pisi.context.config.lock_dir(), 'pisi'), 'w')
except IOError:
raise pisi.errors.PrivilegeError(_("You have to be root for this operation."))
try: try:
fcntl.flock(lock, fcntl.LOCK_EX | fcntl.LOCK_NB) fcntl.flock(lock, fcntl.LOCK_EX | fcntl.LOCK_NB)
try: try:
+3
View File
@@ -11,3 +11,6 @@
class AnotherInstanceError(Exception): class AnotherInstanceError(Exception):
pass pass
class PrivilegeError(Exception):
pass