summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorPhil Blundell <philb@gnu.org>2011-11-14 13:06:51 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-11-16 17:19:12 +0000
commit3cbd20dbf87259cc0e70a222bca92bc86f3b3e94 (patch)
tree31fe83e8b16e71cd4b76a3c87e29acfd9fde4354 /meta
parentfa81f8dfb7a342e355b608aa4204cf23ed2b251c (diff)
downloadpoky-3cbd20dbf87259cc0e70a222bca92bc86f3b3e94.tar.gz
libnss-mdns: avoid race condition in postinst
Writing to "/tmp/nsswitch.conf" leads to a race condition if two copies of the postinst are running simultaneously. Fix this by modifying /etc/nsswitch.conf in place using sed -i. Also make the same change to the prerm for consistency although the race will not occur here in practice. (From OE-Core rev: 689884653938b98899fb3ba791221fdbe2f40e7f) Signed-off-by: Phil Blundell <philb@gnu.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-connectivity/libnss-mdns/libnss-mdns_0.10.bb8
1 files changed, 3 insertions, 5 deletions
diff --git a/meta/recipes-connectivity/libnss-mdns/libnss-mdns_0.10.bb b/meta/recipes-connectivity/libnss-mdns/libnss-mdns_0.10.bb
index 5f614f86a2..87707142d5 100644
--- a/meta/recipes-connectivity/libnss-mdns/libnss-mdns_0.10.bb
+++ b/meta/recipes-connectivity/libnss-mdns/libnss-mdns_0.10.bb
@@ -7,7 +7,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=2d5025d4aa3495befef8f17206a5b0a1"
7 7
8DEPENDS = "avahi" 8DEPENDS = "avahi"
9RDEPENDS_${PN} = "avahi-daemon" 9RDEPENDS_${PN} = "avahi-daemon"
10PR = "r3" 10PR = "r4"
11 11
12SRC_URI = "http://0pointer.de/lennart/projects/nss-mdns/nss-mdns-${PV}.tar.gz" 12SRC_URI = "http://0pointer.de/lennart/projects/nss-mdns/nss-mdns-${PV}.tar.gz"
13 13
@@ -26,14 +26,12 @@ EXTRA_OECONF = "--libdir=${base_libdir} --disable-lynx --enable-avahi"
26# TODO: pattern based configuration update 26# TODO: pattern based configuration update
27pkg_postinst_${PN} () { 27pkg_postinst_${PN} () {
28 cat $D/etc/nsswitch.conf | grep "hosts:\s*files dns$" > /dev/null && { 28 cat $D/etc/nsswitch.conf | grep "hosts:\s*files dns$" > /dev/null && {
29 cat $D/etc/nsswitch.conf | sed 's/hosts:\s*files dns/& mdns4/' > /tmp/nsswitch.conf 29 sed -i 's/hosts:\s*files dns/& mdns4/' $D/etc/nsswitch.conf
30 mv /tmp/nsswitch.conf $D/etc/nsswitch.conf
31 } 30 }
32} 31}
33 32
34pkg_prerm_${PN} () { 33pkg_prerm_${PN} () {
35 cat /etc/nsswitch.conf | grep "hosts:\s*files dns mdns4$" > /dev/null && { 34 cat /etc/nsswitch.conf | grep "hosts:\s*files dns mdns4$" > /dev/null && {
36 cat /etc/nsswitch.conf | sed 's/\(hosts:\s*files dns\) mdns4*/\1/' > /tmp/nsswitch.conf 35 sed -i 's/\(hosts:\s*files dns\) mdns4*/\1/' /etc/nsswitch.conf
37 mv /tmp/nsswitch.conf /etc/nsswitch.conf
38 } 36 }
39} 37}