From owner-svn-src-head@freebsd.org Mon Jun 13 00:03:56 2016 Return-Path: Delivered-To: svn-src-head@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 2C57FAF1393; Mon, 13 Jun 2016 00:03:56 +0000 (UTC) (envelope-from oshogbo@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 F2E3E29D3; Mon, 13 Jun 2016 00:03:55 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5D03tUI021132; Mon, 13 Jun 2016 00:03:55 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5D03txm021131; Mon, 13 Jun 2016 00:03:55 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201606130003.u5D03txm021131@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Mon, 13 Jun 2016 00:03:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r301844 - head/lib/libcasper/libcasper X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 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: Mon, 13 Jun 2016 00:03:56 -0000 Author: oshogbo Date: Mon Jun 13 00:03:55 2016 New Revision: 301844 URL: https://svnweb.freebsd.org/changeset/base/301844 Log: Don't close fd if it's lower then stderr, otherwise we can close one of the descriptor which we just set. Pointed out by: jilles Approved by: re (hrs) Modified: head/lib/libcasper/libcasper/service.c Modified: head/lib/libcasper/libcasper/service.c ============================================================================== --- head/lib/libcasper/libcasper/service.c Sun Jun 12 23:34:48 2016 (r301843) +++ head/lib/libcasper/libcasper/service.c Mon Jun 13 00:03:55 2016 (r301844) @@ -360,7 +360,8 @@ stdnull(void) if (dup2(fd, STDERR_FILENO) == -1) errx(1, "Unable to cover stderr"); - close(fd); + if (fd > STDERR_FILENO) + close(fd); } static void