[arch-projects] [devtools] [PATCH 6/9] lib/common.sh: Add a lock_close function.

Luke Shumaker LukeShu at sbcglobal.net
Sat May 10 22:22:08 EDT 2014


---
 archbuild.in     | 2 +-
 lib/common.sh    | 8 ++++++++
 makechrootpkg.in | 2 +-
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/archbuild.in b/archbuild.in
index dc45c7f..618d0f0 100644
--- a/archbuild.in
+++ b/archbuild.in
@@ -56,7 +56,7 @@ if ${clean_first} || [[ ! -d "${chroots}/${repo}-${arch}" ]]; then
 		fi
 		rm -rf --one-file-system "${copy}"
 	done
-	exec 9>&-
+	lock_close 9
 
 	rm -rf --one-file-system "${chroots}/${repo}-${arch}"
 	mkdir -p "${chroots}/${repo}-${arch}"
diff --git a/lib/common.sh b/lib/common.sh
index b885080..38e31a2 100644
--- a/lib/common.sh
+++ b/lib/common.sh
@@ -158,6 +158,14 @@ slock() {
 }
 
 ##
+#  usage : lock_close( $fd )
+##
+lock_close() {
+	local fd=$1
+	eval "exec $fd>&-"
+}
+
+##
 # usage: pkgver_equal( $pkgver1, $pkgver2 )
 ##
 pkgver_equal() {
diff --git a/makechrootpkg.in b/makechrootpkg.in
index c3edc72..731b560 100644
--- a/makechrootpkg.in
+++ b/makechrootpkg.in
@@ -155,7 +155,7 @@ create_chroot() {
 		stat_done
 
 		# Drop the read lock again
-		exec 8>&-
+		lock_close 8
 	fi
 
 	# Update mtime
-- 
1.9.2



More information about the arch-projects mailing list