aboutsummaryrefslogtreecommitdiffstats
path: root/package/block-mount
diff options
context:
space:
mode:
authorDaniel Dickinson <daniel@cshore.neomailbox.net>2010-07-12 16:35:39 +0000
committerDaniel Dickinson <daniel@cshore.neomailbox.net>2010-07-12 16:35:39 +0000
commitefa3beb78bf3e783efff9380df980edde2f996cd (patch)
tree42358ca3ccaaa4001634513df3df12be38410215 /package/block-mount
parentd2f3a21390b5566eaf55265aa7509f52450f8827 (diff)
downloadupstream-efa3beb78bf3e783efff9380df980edde2f996cd.tar.gz
upstream-efa3beb78bf3e783efff9380df980edde2f996cd.tar.bz2
upstream-efa3beb78bf3e783efff9380df980edde2f996cd.zip
[package]: block-mount: Fixed two bugs in fstab.init. /etc/fstab was used where /tmp/fstab should have been, and locking was insufficiently careful and was such that it could result in deadlock when hotplug was in use.
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@22148 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/block-mount')
-rw-r--r--package/block-mount/files/fstab.init10
1 files changed, 7 insertions, 3 deletions
diff --git a/package/block-mount/files/fstab.init b/package/block-mount/files/fstab.init
index d755eccf08..fdcd4f52a2 100644
--- a/package/block-mount/files/fstab.init
+++ b/package/block-mount/files/fstab.init
@@ -41,9 +41,13 @@ do_swapoff() {
start() {
config_load fstab
mkdir -p /var/lock
- lock /var/lock/fstab.lck
- echo '# WARNING: this is an auto generated file, please use uci to set defined filesystems' > /etc/fstab
- lock -u /var/lock/fstab.lck
+ lock -w /var/lock/fstab.lck && {
+ lock /var/lock/fstab.lck
+ [ -e /tmp/fstab ] || {
+ echo '# WARNING: this is an auto generated file, please use uci to set defined filesystems' > /tmp/fstab
+ }
+ lock -u /var/lock/fstab.lck
+ }
config_foreach do_swapon swap
config_foreach do_mount mount
}