Date: Sun, 23 Jun 2019 16:00:30 +0000 (UTC) From: Ian Lepore <ian@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r349312 - stable/12/libexec/rc/rc.d Message-ID: <201906231600.x5NG0UgB055942@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ian Date: Sun Jun 23 16:00:29 2019 New Revision: 349312 URL: https://svnweb.freebsd.org/changeset/base/349312 Log: MFC r348141, r348143 r348141: Handle the driftfile option correctly when ntpd_flags is empty. The logic I originally wrote to detect whether a driftfile option was in the set of flags was based on the result of removing the pattern *flag* being an empty string. That didn't handle the case where the string was empty to begin with. Doh! So now it also specifically checks for an empty string. The result of the bad check was that ntpd would run without a driftfile, but it would do so only if it was running as root instead of the non-priveleged ntpd user, which isn't a typical case. Ntpd runs fine without a driftfile, although it does take it longer to stabilize the clock frequency at startup. Reported by: avg@ Pointy hat: ian@ r348143: Remove accidentally-added blank line; the style throughout this file is to use no whitespace between a comment block and the code it describes. Modified: stable/12/libexec/rc/rc.d/ntpd Directory Properties: stable/12/ (props changed) Modified: stable/12/libexec/rc/rc.d/ntpd ============================================================================== --- stable/12/libexec/rc/rc.d/ntpd Sun Jun 23 15:58:46 2019 (r349311) +++ stable/12/libexec/rc/rc.d/ntpd Sun Jun 23 16:00:29 2019 (r349312) @@ -90,9 +90,10 @@ ntpd_precmd() if can_run_nonroot; then _user="ntpd" driftopt="-f ${_ntp_default_driftfile}" - elif [ -z "${rc_flags##*-f*}" ] || - [ -z "${rc_flags##*--driftfile*}" ] || - grep -q "^[ \t]*driftfile" "${ntpd_config}"; then + elif grep -q "^[ \t]*driftfile" "${ntpd_config}" || + [ -n "${rc_flags}" ] && + ( [ -z "${rc_flags##*-f*}" ] || + [ -z "${rc_flags##*--driftfile*}" ] ); then driftopt="" # admin set the option, we don't need to add it. elif [ -f "${_ntp_old_driftfile}" ]; then driftopt="-f ${_ntp_old_driftfile}"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201906231600.x5NG0UgB055942>