summaryrefslogtreecommitdiff
path: root/package
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2007-07-12 21:59:38 +0000
committerFelix Fietkau <nbd@openwrt.org>2007-07-12 21:59:38 +0000
commit1b4380b8edfc66ee57f7d016308fd9d92eea8874 (patch)
treef5a1d58bbf0383cedac440a62d3b059147c9c0a9 /package
parentf82f62b9920538d9d650bab2ef9690d55df0b720 (diff)
downloadmtk-20170518-1b4380b8edfc66ee57f7d016308fd9d92eea8874.zip
mtk-20170518-1b4380b8edfc66ee57f7d016308fd9d92eea8874.tar.gz
mtk-20170518-1b4380b8edfc66ee57f7d016308fd9d92eea8874.tar.bz2
avoid a race condition that might lead to dnsmasq reading an empty resolv.conf (#2007)
SVN-Revision: 7952
Diffstat (limited to 'package')
-rwxr-xr-xpackage/base-files/files/usr/share/udhcpc/default.script7
1 files changed, 4 insertions, 3 deletions
diff --git a/package/base-files/files/usr/share/udhcpc/default.script b/package/base-files/files/usr/share/udhcpc/default.script
index a3a696b..7ce3d2a 100755
--- a/package/base-files/files/usr/share/udhcpc/default.script
+++ b/package/base-files/files/usr/share/udhcpc/default.script
@@ -47,12 +47,13 @@ case "$1" in
}
[ -n "$dns" ] && {
- echo -n > $RESOLV_CONF
- ${domain:+echo search $domain} >> $RESOLV_CONF
+ echo -n > "${RESOLV_CONF}.tmp"
+ ${domain:+echo search $domain} >> "${RESOLV_CONF}.tmp"
for i in $dns ; do
echo "adding dns $i"
- echo "nameserver $i" >> $RESOLV_CONF
+ echo "nameserver $i" >> "${RESOLV_CONF}.tmp"
done
+ mv "${RESOLV_CONF}.tmp" "$RESOLV_CONF"
}
hotplug_event ifup