diff options
author | Felix Fietkau <nbd@openwrt.org> | 2007-07-12 21:59:38 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2007-07-12 21:59:38 +0000 |
commit | dbb01d5eaa2f983bfb3da64e81e0186c5f40382d (patch) | |
tree | 3f05fe4fec45dab44c2434e863891b702d8b8c15 /package/base-files | |
parent | 8420b16bb65036246523f59712653d679a38dd2a (diff) | |
download | upstream-dbb01d5eaa2f983bfb3da64e81e0186c5f40382d.tar.gz upstream-dbb01d5eaa2f983bfb3da64e81e0186c5f40382d.tar.bz2 upstream-dbb01d5eaa2f983bfb3da64e81e0186c5f40382d.zip |
avoid a race condition that might lead to dnsmasq reading an empty resolv.conf (#2007)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@7952 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/base-files')
-rwxr-xr-x | package/base-files/files/usr/share/udhcpc/default.script | 7 |
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 a3a696be70..7ce3d2aa89 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 |