[oe-commits] Chen Qi : runqemu-internal: get rid of annoying but harmless error message

git at git.openembedded.org git at git.openembedded.org
Tue Feb 3 14:54:16 UTC 2015


Module: openembedded-core.git
Branch: master
Commit: 039c57257c4180b0688fc2ec1b03948276009b04
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=039c57257c4180b0688fc2ec1b03948276009b04

Author: Chen Qi <Qi.Chen at windriver.com>
Date:   Thu Jan 29 13:44:18 2015 +0800

runqemu-internal: get rid of annoying but harmless error message

If tap0 interface has been created by other users on the system, we would
get error messages when using runqemu. Error messages are like below.
     Acquiring lockfile for tap0...
     touch: cannot touch ‘/tmp/qemu-tap-locks/tap0.lock’: Permission denied
     /buildarea2/chenqi/poky/scripts/runqemu-internal: line 139: /tmp/qemu-tap-locks/tap0.lock: Permission denied
     flock: 8: Bad file descriptor

The system can still boot up because runqemu would try to create a new tap
interface. So the error message above is harmless, yet somewhat annoying.

This patch fixes the above problem. With this patch, the output would be as
follows.

Acquiring lockfile for tap0...
Acquiring lockfile for /tmp/qemu-tap-locks/tap0.lock failed
Setting up tap interface under sudo
Acquiring lockfile for tap1...
Running qemu-system-arm...

Signed-off-by: Chen Qi <Qi.Chen at windriver.com>
Signed-off-by: Ross Burton <ross.burton at intel.com>

---

 scripts/runqemu-internal | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/scripts/runqemu-internal b/scripts/runqemu-internal
index 5711bd3..a0a1e96 100755
--- a/scripts/runqemu-internal
+++ b/scripts/runqemu-internal
@@ -138,7 +138,11 @@ else
                 return 1
             fi
 
-            touch $lockfile.lock
+            touch $lockfile.lock 2>/dev/null
+            if [ $? -ne 0 ]; then
+                echo "Acquiring lockfile for $lockfile.lock failed"
+                return 1
+            fi
             exec 8>$lockfile.lock
             flock -n -x 8
             if [ $? -ne 0 ]; then



More information about the Openembedded-commits mailing list