Patchwork [meta-networking,3/3] ntpd: make start-stop-daemon command available for ntpd

login
register
mail settings
Submitter Mark Hatle
Date Nov. 19, 2013, 9:50 p.m.
Message ID <1384897838-11066-4-git-send-email-mark.hatle@windriver.com>
Download mbox | patch
Permalink /patch/61993/
State Accepted, archived
Headers show

Comments

Mark Hatle - Nov. 19, 2013, 9:50 p.m.
From: Qiang Chen <qiang.chen@windriver.com>

If ntpd script is being called by a non-root user using sudo,
it will fail as follows:

/etc/init.d/ntpd restart
Stopping ntpd: /etc/init.d/ntpd: line 29: start-stop-daemon:
command not found
done
Starting ntpd: /etc/init.d/ntpd: line 24: start-stop-daemon:
command not found
done

This is because /etc/init.d/ntpd calls start-stop-daemon which
is in /sbin (not in the default path for non-root users)

Explicitly configure the PATH to include /sbin.

Signed-off-by: Qiang Chen <qiang.chen@windriver.com>
Signed-off-by: Jeff Polk <jeff.polk@windriver.com>

Reworked to set PATH instead of hardcode the location of start-stop-daemon

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
---
 meta-networking/recipes-support/ntp/files/ntpd | 2 ++
 1 file changed, 2 insertions(+)
Joe MacDonald - Nov. 26, 2013, 4:25 p.m.
Also merged.  Thanks.
-J.

[[meta-networking][PATCH 3/3] ntpd: make start-stop-daemon command available for ntpd] On 13.11.19 (Tue 15:50) Mark Hatle wrote:

> From: Qiang Chen <qiang.chen@windriver.com>
> 
> If ntpd script is being called by a non-root user using sudo,
> it will fail as follows:
> 
> /etc/init.d/ntpd restart
> Stopping ntpd: /etc/init.d/ntpd: line 29: start-stop-daemon:
> command not found
> done
> Starting ntpd: /etc/init.d/ntpd: line 24: start-stop-daemon:
> command not found
> done
> 
> This is because /etc/init.d/ntpd calls start-stop-daemon which
> is in /sbin (not in the default path for non-root users)
> 
> Explicitly configure the PATH to include /sbin.
> 
> Signed-off-by: Qiang Chen <qiang.chen@windriver.com>
> Signed-off-by: Jeff Polk <jeff.polk@windriver.com>
> 
> Reworked to set PATH instead of hardcode the location of start-stop-daemon
> 
> Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
> ---
>  meta-networking/recipes-support/ntp/files/ntpd | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/meta-networking/recipes-support/ntp/files/ntpd b/meta-networking/recipes-support/ntp/files/ntpd
> index ae50f13..53fa2d1 100755
> --- a/meta-networking/recipes-support/ntp/files/ntpd
> +++ b/meta-networking/recipes-support/ntp/files/ntpd
> @@ -1,5 +1,7 @@
>  #! /bin/sh
>  #
> +PATH=/sbin:/bin:/usr/bin:/usr/sbin
> +
>  # ntpd	init.d script for ntpdc from ntp.isc.org
>  test -x /usr/bin/ntpd -a -r /etc/ntp.conf || exit 0
>  # rcS contains TICKADJ

Patch

diff --git a/meta-networking/recipes-support/ntp/files/ntpd b/meta-networking/recipes-support/ntp/files/ntpd
index ae50f13..53fa2d1 100755
--- a/meta-networking/recipes-support/ntp/files/ntpd
+++ b/meta-networking/recipes-support/ntp/files/ntpd
@@ -1,5 +1,7 @@ 
 #! /bin/sh
 #
+PATH=/sbin:/bin:/usr/bin:/usr/sbin
+
 # ntpd	init.d script for ntpdc from ntp.isc.org
 test -x /usr/bin/ntpd -a -r /etc/ntp.conf || exit 0
 # rcS contains TICKADJ