From owner-svn-src-head@freebsd.org Fri Feb 8 13:23:09 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 219CA14E0811; Fri, 8 Feb 2019 13:23:09 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from ecc03.stack.nl (ecc03.stack.nl [IPv6:2001:610:1108:5010::210]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.stack.nl", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6A7778243F; Fri, 8 Feb 2019 13:23:08 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mail02.stack.nl (blade.stack.nl [51.15.111.152]) by ecc03.stack.nl (Postfix) with ESMTPS id 5317E200F0; Fri, 8 Feb 2019 13:23:05 +0000 (UTC) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail02.stack.nl (Postfix) with ESMTP id 23D7F241142; Fri, 8 Feb 2019 13:23:05 +0000 (UTC) Received: from mail02.stack.nl ([127.0.0.1]) by localhost (mail02.stack.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9BHVPuQm8qqh; Fri, 8 Feb 2019 13:23:01 +0000 (UTC) Received: from blade.stack.nl (blade.stack.nl [192.168.122.130]) by mail02.stack.nl (Postfix) with ESMTP id CDAE4240348; Fri, 8 Feb 2019 13:23:01 +0000 (UTC) Received: by blade.stack.nl (Postfix, from userid 1677) id A9C90201F0; Fri, 8 Feb 2019 14:23:01 +0100 (CET) Date: Fri, 8 Feb 2019 14:23:01 +0100 From: Jilles Tjoelker To: Konstantin Belousov , Ryan Moeller , Nash Kaminski Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r343896 - head/sbin/dhclient Message-ID: <20190208132301.GA5715@stack.nl> References: <201902080736.x187a8LM002846@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201902080736.x187a8LM002846@repo.freebsd.org> User-Agent: Mutt/1.9.4 (2018-02-28) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Feb 2019 13:23:09 -0000 On Fri, Feb 08, 2019 at 07:36:08AM +0000, Konstantin Belousov wrote: > Author: kib > Date: Fri Feb 8 07:36:08 2019 > New Revision: 343896 > URL: https://svnweb.freebsd.org/changeset/base/343896 > Log: > Correctly return exit status from the exited process. > This is also OpenBSD rev. 1.117, as pointed out by > Ryan Moeller . > Submitted by: Nash Kaminski > MFC after: 1 week > Modified: > head/sbin/dhclient/dhclient.c > Modified: head/sbin/dhclient/dhclient.c > ============================================================================== > --- head/sbin/dhclient/dhclient.c Fri Feb 8 06:19:28 2019 (r343895) > +++ head/sbin/dhclient/dhclient.c Fri Feb 8 07:36:08 2019 (r343896) > @@ -2348,7 +2348,7 @@ priv_script_go(void) > if (ip) > script_flush_env(ip->client); > > - return (wstatus & 0xff); > + return WEXITSTATUS(wstatus); > } > > void This is probably a big improvement in practice, but it is still wrong if the script exits on a signal. POSIX does not say what the WEXITSTATUS macro returns in this case and in practice 0 is a common value. Perhaps you want return WIFEXITED(wstatus) ? WEXITSTATUS(wstatus) : 128 + WTERMSIG(wstatus); imitating what the shell does to translate a wait status into 8 bits? -- Jilles Tjoelker