From: Vincent Date: Sat, 27 Feb 2010 08:57:48 +0000 (+0100) Subject: Ensure that umask is set at a sensible value before building the chroot. X-Git-Tag: 0.5.0~23 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ed1e79270d94eef34d5ce82041299183567dbf86;p=thirdparty%2Flldpd.git Ensure that umask is set at a sensible value before building the chroot. Since the unprivileged process needs to be able to read /etc/localtime in the chroot, we ensure that the umask is set correctly for this. --- diff --git a/debian/lldpd.init.d b/debian/lldpd.init.d index e33d84a0..aa44315d 100644 --- a/debian/lldpd.init.d +++ b/debian/lldpd.init.d @@ -31,10 +31,12 @@ CHROOT=/var/run/$NAME do_chroot() { - [ -d $CHROOT ] || mkdir -p $CHROOT - [ -d $CHROOT/etc ] || mkdir $CHROOT/etc + oldumask=$(umask) + umask 022 + [ -d $CHROOT/etc ] || mkdir -p $CHROOT/etc [ -f $CHROOT/etc/localtime ] || [ ! -f /etc/localtime ] || \ cp /etc/localtime $CHROOT/etc/localtime + umask $oldumask } do_start() diff --git a/redhat/lldpd.init b/redhat/lldpd.init index 9a2056e4..67f521fc 100644 --- a/redhat/lldpd.init +++ b/redhat/lldpd.init @@ -36,10 +36,12 @@ chroot=/var/run/lldpd build_chroot() { - [ -d $chroot ] || mkdir -p $chroot - [ -d $chroot/etc ] || mkdir $chroot/etc + oldumask=$(umask) + umask 022 + [ -d $chroot/etc ] || mkdir -p $chroot/etc [ -f $chroot/etc/localtime ] || [ ! -f /etc/localtime ] || \ cp /etc/localtime $chroot/etc/localtime + umask $oldumask } start() {