From owner-svn-src-all@freebsd.org Fri Dec 18 19:58:36 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 17CF8A4AF0A; Fri, 18 Dec 2015 19:58:36 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DDAE91602; Fri, 18 Dec 2015 19:58:35 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBIJwZQh005825; Fri, 18 Dec 2015 19:58:35 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBIJwZ6X005824; Fri, 18 Dec 2015 19:58:35 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201512181958.tBIJwZ6X005824@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Fri, 18 Dec 2015 19:58:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r292450 - stable/10/etc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Dec 2015 19:58:36 -0000 Author: jilles Date: Fri Dec 18 19:58:34 2015 New Revision: 292450 URL: https://svnweb.freebsd.org/changeset/base/292450 Log: MFC r291770: rc.subr: Check for running daemons before a custom start_cmd is executed. Currently rc scripts implementing their own start_cmd do not enjoy the benefits of rc.subr's own check for rc_pid. This leads to around a third of ports with such a start_cmd not to check for the process at all and two thirds of ports to re-implement this check (sometimes wrongly). This patch moves the check for rc_pid to before ${rc_arg}_cmd is executed. Submitted by: Dirk Engling Reviewed by: feld Relnotes: yes Modified: stable/10/etc/rc.subr Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/rc.subr ============================================================================== --- stable/10/etc/rc.subr Fri Dec 18 19:29:58 2015 (r292449) +++ stable/10/etc/rc.subr Fri Dec 18 19:58:34 2015 (r292450) @@ -974,6 +974,14 @@ run_rc_command() fi fi + if [ $rc_arg = "start" -a -z "$rc_fast" -a -n "$rc_pid" ]; then + if [ -z "$rc_quiet" ]; then + echo 1>&2 "${name} already running? " \ + "(pid=$rc_pid)." + fi + return 1 + fi + # if there's a custom ${XXX_cmd}, # run that instead of the default # @@ -1002,14 +1010,6 @@ run_rc_command() ;; start) - if [ -z "$rc_fast" -a -n "$rc_pid" ]; then - if [ -z "$rc_quiet" ]; then - echo 1>&2 "${name} already running? " \ - "(pid=$rc_pid)." - fi - return 1 - fi - if [ ! -x "${_chroot}${_chroot:+/}${command}" ]; then warn "run_rc_command: cannot run $command" return 1