From 0d611979150b99081d43d4969c90616bd75bb8d1 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Wed, 10 Mar 2010 22:20:48 +0100 Subject: [PATCH] For Redhat, adapt init.d script to initialize the chroot. The chroot is an empty directory containing a copy of /etc/localtime to enable the use of the correct timestamp when logging for the process trapped in the chroot. --- CHANGELOG | 4 +++- redhat/lldpd.init | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 2b94e696..c5b34d8b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,7 +1,9 @@ lldpd (0.4.2) - * Misc fix: + * Misc fixes: + fix a crash when an interface is removed + + copy /etc/localtime into chroot before starting lldpd daemon to + ensure correct timestamps for logs. -- Vincent Bernat diff --git a/redhat/lldpd.init b/redhat/lldpd.init index a8d494f8..9a2056e4 100644 --- a/redhat/lldpd.init +++ b/redhat/lldpd.init @@ -32,6 +32,15 @@ RETVAL=0 prog="lldpd" binary=/usr/sbin/lldpd pidfile=/var/run/lldpd.pid +chroot=/var/run/lldpd + +build_chroot() +{ + [ -d $chroot ] || mkdir -p $chroot + [ -d $chroot/etc ] || mkdir $chroot/etc + [ -f $chroot/etc/localtime ] || [ ! -f /etc/localtime ] || \ + cp /etc/localtime $chroot/etc/localtime +} start() { [ -x $binary ] || exit 5 @@ -40,6 +49,7 @@ start() { RETVAL=1 failure else + build_chroot daemon --pidfile=$pidfile $binary $OPTIONS RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/lldpd -- 2.39.5