From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jacek Konieczny Subject: [PATCH] Fix locking in tools/hotplug/Linux/locking.sh Date: Fri, 9 Nov 2012 14:56:11 +0100 Message-ID: <1352469371-15457-1-git-send-email-jajcus@jajcus.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xensource.com Cc: Jacek Konieczny List-Id: xen-devel@lists.xenproject.org The claim_lock() function would fail in the perl code with: Invalid argument at -e line 2. because the Perl snippet opens for reading the file descriptor, which was earlier opened for write (append). Signed-off-by: Jacek Konieczny --- tools/hotplug/Linux/locking.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/hotplug/Linux/locking.sh b/tools/hotplug/Linux/locking.sh index e34f155..122bcfb 100644 --- a/tools/hotplug/Linux/locking.sh +++ b/tools/hotplug/Linux/locking.sh @@ -44,7 +44,7 @@ claim_lock() # See below for a correctness proof. local rightfile while true; do - eval "exec $_lockfd>>$_lockfile" + eval "exec $_lockfd<>$_lockfile" flock -x $_lockfd || return $? # We can't just stat /dev/stdin or /proc/self/fd/$_lockfd or # use bash's test -ef because those all go through what is -- 1.7.12.4