summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/_emerge/emergelog.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/pym/_emerge/emergelog.py b/pym/_emerge/emergelog.py
index d6ef1b4df..b1b093f52 100644
--- a/pym/_emerge/emergelog.py
+++ b/pym/_emerge/emergelog.py
@@ -49,15 +49,12 @@ def emergelog(xterm_titles, mystr, short_msg=None):
portage.util.apply_secpass_permissions(file_path,
uid=portage.portage_uid, gid=portage.portage_gid,
mode=0o660)
- mylock = None
+ mylock = portage.locks.lockfile(file_path)
try:
- mylock = portage.locks.lockfile(mylogfile)
mylogfile.write(_log_fmt % (time.time(), mystr))
- mylogfile.flush()
- finally:
- if mylock:
- portage.locks.unlockfile(mylock)
mylogfile.close()
+ finally:
+ portage.locks.unlockfile(mylock)
except (IOError,OSError,portage.exception.PortageException) as e:
if secpass >= 1:
print("emergelog():",e, file=sys.stderr)