[oe-commits] [openembedded-core] 11/27: runqemu: fix get portlock fail for multi users

git at git.openembedded.org git at git.openembedded.org
Sat Aug 3 13:35:30 UTC 2019


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 797efbdb90bf2ff79d56ecc90ad8ba97827bf5d1
Author: Changqing Li <changqing.li at windriver.com>
AuthorDate: Fri Aug 2 10:43:59 2019 +0800

    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
    
    Signed-off-by: Changqing Li <changqing.li at windriver.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 scripts/runqemu | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/scripts/runqemu b/scripts/runqemu
index 6fae3d8..9d6a2e8 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -235,7 +235,7 @@ class BaseConfig(object):
         else:
             return False
 
-    def acquire_portlock(self, lockfile, error=True):
+    def acquire_portlock(self, lockfile):
         logger.debug("Acquiring lockfile %s..." % lockfile)
         try:
             portlock_descriptor = open(lockfile, 'w')
@@ -243,11 +243,8 @@ class BaseConfig(object):
             fcntl.flock(self.portlocks[lockfile], fcntl.LOCK_EX|fcntl.LOCK_NB)
         except Exception as e:
             msg = "Acquiring lockfile %s failed: %s" % (lockfile, e)
-            if error:
-                logger.error(msg)
-            else:
-                logger.info(msg)
-            if self.portlocks[lockfile]:
+            logger.info(msg)
+            if lockfile in self.portlocks.keys() and self.portlocks[lockfile]:
                 self.portlocks[lockfile].close()
                 del self.portlocks[lockfile]
             return False

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list