From ed1e79270d94eef34d5ce82041299183567dbf86 Mon Sep 17 00:00:00 2001 From: Vincent Date: Sat, 27 Feb 2010 09:57:48 +0100 Subject: [PATCH] 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. --- debian/lldpd.init.d | 6 ++++-- redhat/lldpd.init | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) 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() { -- 2.39.5