summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorChangqing Li <changqing.li@windriver.com>2019-08-02 10:43:59 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-08-03 23:56:01 +0100
commitf2a951f479bbb68ae7702785c7916325fc97f1c2 (patch)
treefe33ccea0e8cd49708669bae1043e9e21124f69f /scripts
parent5cc460d17707a66d77aa06c7dcab0037edadadb1 (diff)
downloadpoky-f2a951f479bbb68ae7702785c7916325fc97f1c2.tar.gz
runqemu: fix get portlock fail for multi users
when runqemu with slirp option on same host with different users, it will report PermissionError: [Errno 13] Permission denied: '/tmp/qemu-port-locks/2222.lock' and during handle this exception, another exception happened since key not exist. Fix by check if key exist first (From OE-Core rev: 56f30e5377ebe5cc4544f081e001934706a0d8d3) Signed-off-by: Changqing Li <changqing.li@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/runqemu9
1 files changed, 3 insertions, 6 deletions
diff --git a/scripts/runqemu b/scripts/runqemu
index 6fae3d8c5d..9d6a2e86d4 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -235,7 +235,7 @@ class BaseConfig(object):
235 else: 235 else:
236 return False 236 return False
237 237
238 def acquire_portlock(self, lockfile, error=True): 238 def acquire_portlock(self, lockfile):
239 logger.debug("Acquiring lockfile %s..." % lockfile) 239 logger.debug("Acquiring lockfile %s..." % lockfile)
240 try: 240 try:
241 portlock_descriptor = open(lockfile, 'w') 241 portlock_descriptor = open(lockfile, 'w')
@@ -243,11 +243,8 @@ class BaseConfig(object):
243 fcntl.flock(self.portlocks[lockfile], fcntl.LOCK_EX|fcntl.LOCK_NB) 243 fcntl.flock(self.portlocks[lockfile], fcntl.LOCK_EX|fcntl.LOCK_NB)
244 except Exception as e: 244 except Exception as e:
245 msg = "Acquiring lockfile %s failed: %s" % (lockfile, e) 245 msg = "Acquiring lockfile %s failed: %s" % (lockfile, e)
246 if error: 246 logger.info(msg)
247 logger.error(msg) 247 if lockfile in self.portlocks.keys() and self.portlocks[lockfile]:
248 else:
249 logger.info(msg)
250 if self.portlocks[lockfile]:
251 self.portlocks[lockfile].close() 248 self.portlocks[lockfile].close()
252 del self.portlocks[lockfile] 249 del self.portlocks[lockfile]
253 return False 250 return False