From owner-svn-src-head@freebsd.org Thu Nov 24 20:30: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 2E3A3C54E0C; Thu, 24 Nov 2016 20:30:56 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io0-f180.google.com (mail-io0-f180.google.com [209.85.223.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 01D20677; Thu, 24 Nov 2016 20:30:55 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io0-f180.google.com with SMTP id x94so94951186ioi.3; Thu, 24 Nov 2016 12:30:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc:content-transfer-encoding; bh=rh6Wz68ZKqpb8rkxRW7aE3FviScZGvCMpQttkSAIr2A=; b=kZgIBNhWWz4qRiwxl1W43b34DjUkz2whsmpX3r85YB4n5fnXj9PjUyQulLEjCC0XWx JDurtVNpajRGtW8QKT1CKS6lFTX0/5yKz0mlDOOA5gawYYd52HChtsK207+5XF2S+3tC HEveI5y8Pn8H5PqfUBYiHqo3y9Xy+Oz4Yi4w49n1GvdVqUpRQBKVGOyHp3VzAMnf1MDY +ZVuKNaoeAxLA2Vj32S0X1pbRgaptQAQzk4VwMweYqntuGYhXTHoKSvkxxvF1SIhLDcD XqTuoKzEJxHgYGOAiwal45rz3SO4R+tF611Gv9cZKMstzDG4EpmWiqY0N0eSkNYb9Ycg a8hg== X-Gm-Message-State: AKaTC015JCQmtnTlasKM0hTaLstTwGaiaUKqPTga0H5KTVYGPw2u/KZA55Nmsg6uMGs/ZQ== X-Received: by 10.36.190.6 with SMTP id i6mr3464492itf.37.1480016053137; Thu, 24 Nov 2016 11:34:13 -0800 (PST) Received: from mail-io0-f176.google.com (mail-io0-f176.google.com. [209.85.223.176]) by smtp.gmail.com with ESMTPSA id f142sm13881252iof.44.2016.11.24.11.34.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Nov 2016 11:34:12 -0800 (PST) Received: by mail-io0-f176.google.com with SMTP id a124so93144088ioe.2; Thu, 24 Nov 2016 11:34:12 -0800 (PST) X-Received: by 10.107.16.170 with SMTP id 42mr3442509ioq.93.1480016052569; Thu, 24 Nov 2016 11:34:12 -0800 (PST) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.36.109.68 with HTTP; Thu, 24 Nov 2016 11:34:12 -0800 (PST) In-Reply-To: <201611241450.uAOEoLA5079215@repo.freebsd.org> References: <201611241450.uAOEoLA5079215@repo.freebsd.org> From: Conrad Meyer Date: Thu, 24 Nov 2016 11:34:12 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r309109 - head/lib/libutil To: =?UTF-8?Q?Dag=2DErling_Sm=C3=B8rgrav?= Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 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: Thu, 24 Nov 2016 20:30:56 -0000 This kind of language isn't really appropriate. Please revert the commit immediately. When you've had time to think of an appropriate way to word comments to the same effect, please commit that separately. Thanks, Conrad On Thu, Nov 24, 2016 at 6:50 AM, Dag-Erling Sm=C3=B8rgrav = wrote: > Author: des > Date: Thu Nov 24 14:50:21 2016 > New Revision: 309109 > URL: https://svnweb.freebsd.org/changeset/base/309109 > > Log: > Add a warning against modifying this code without understanding it, and > an example of how not to make it more portable. I've had this lying > around uncommitted since 2009... > > Modified: > head/lib/libutil/flopen.c > > Modified: head/lib/libutil/flopen.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libutil/flopen.c Thu Nov 24 14:48:46 2016 (r309108) > +++ head/lib/libutil/flopen.c Thu Nov 24 14:50:21 2016 (r309109) > @@ -1,5 +1,5 @@ > /*- > - * Copyright (c) 2007 Dag-Erling Co=C3=AFdan Sm=C3=B8rgrav > + * Copyright (c) 2007-2009 Dag-Erling Co=C3=AFdan Sm=C3=B8rgrav > * All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > @@ -37,6 +37,14 @@ __FBSDID("$FreeBSD$"); > > #include > > +/* > + * Reliably open and lock a file. > + * > + * DO NOT, UNDER PAIN OF DEATH, modify this code without first reading t= he > + * revision history and discussing your changes with . > + * Don't be fooled by the code's apparent simplicity; there would be no > + * need for this function if it was as easy to get right as you think. > + */ > int > flopen(const char *path, int flags, ...) > { > @@ -100,6 +108,14 @@ flopen(const char *path, int flags, ...) > errno =3D serrno; > return (-1); > } > +#ifdef DONT_EVEN_THINK_ABOUT_IT > + if (fcntl(fd, F_SETFD, FD_CLOEXEC) !=3D 0) { > + serrno =3D errno; > + (void)close(fd); > + errno =3D serrno; > + return (-1); > + } > +#endif > return (fd); > } > } >