From owner-svn-src-all@freebsd.org Fri Oct 16 12:53:23 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 B96A7A16FC5; Fri, 16 Oct 2015 12:53:23 +0000 (UTC) (envelope-from des@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 839441923; Fri, 16 Oct 2015 12:53:23 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t9GCrM4S021614; Fri, 16 Oct 2015 12:53:22 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t9GCrMb5021613; Fri, 16 Oct 2015 12:53:22 GMT (envelope-from des@FreeBSD.org) Message-Id: <201510161253.t9GCrMb5021613@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: des set sender to des@FreeBSD.org using -f From: =?UTF-8?Q?Dag-Erling_Sm=c3=b8rgrav?= Date: Fri, 16 Oct 2015 12:53:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r289420 - head/lib/libfetch X-SVN-Group: head 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, 16 Oct 2015 12:53:23 -0000 Author: des Date: Fri Oct 16 12:53:22 2015 New Revision: 289420 URL: https://svnweb.freebsd.org/changeset/base/289420 Log: Use fopen()'s newfangled "e" flag instead of explicit fcntl() calls. PR: 199801 Submitted by: Jukka Ukkonen MFC after: 1 week Modified: head/lib/libfetch/file.c Modified: head/lib/libfetch/file.c ============================================================================== --- head/lib/libfetch/file.c Fri Oct 16 12:21:44 2015 (r289419) +++ head/lib/libfetch/file.c Fri Oct 16 12:53:22 2015 (r289420) @@ -48,7 +48,7 @@ fetchXGetFile(struct url *u, struct url_ if (us && fetchStatFile(u, us, flags) == -1) return (NULL); - f = fopen(u->doc, "r"); + f = fopen(u->doc, "re"); if (f == NULL) { fetch_syserr(); @@ -61,7 +61,6 @@ fetchXGetFile(struct url *u, struct url_ return (NULL); } - fcntl(fileno(f), F_SETFD, FD_CLOEXEC); return (f); } @@ -77,9 +76,9 @@ fetchPutFile(struct url *u, const char * FILE *f; if (CHECK_FLAG('a')) - f = fopen(u->doc, "a"); + f = fopen(u->doc, "ae"); else - f = fopen(u->doc, "w+"); + f = fopen(u->doc, "w+e"); if (f == NULL) { fetch_syserr(); @@ -92,7 +91,6 @@ fetchPutFile(struct url *u, const char * return (NULL); } - fcntl(fileno(f), F_SETFD, FD_CLOEXEC); return (f); }