svn commit: r309109 - head/lib/libutil

Marcelo Araujo araujobsdport at gmail.com
Thu Nov 24 15:27:54 UTC 2016


On Nov 24, 2016 10:50 PM, "Dag-Erling Smørgrav" <des at freebsd.org> 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
>
==============================================================================
> --- 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ïdan Smørgrav
> + * Copyright (c) 2007-2009 Dag-Erling Coïdan Smørgrav
>   * All rights reserved.
>   *
>   * Redistribution and use in source and binary forms, with or without
> @@ -37,6 +37,14 @@ __FBSDID("$FreeBSD$");
>
>  #include <libutil.h>
>
> +/*
> + * Reliably open and lock a file.
> + *
> + * DO NOT, UNDER PAIN OF DEATH, modify this code without first reading
the
> + * revision history and discussing your changes with <des at freebsd.org>.
> + * 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 = serrno;
>                         return (-1);
>                 }
> +#ifdef DONT_EVEN_THINK_ABOUT_IT
> +               if (fcntl(fd, F_SETFD, FD_CLOEXEC) != 0) {
> +                       serrno = errno;
> +                       (void)close(fd);
> +                       errno = serrno;
> +                       return (-1);
> +               }
> +#endif
>                 return (fd);
>         }
>  }
>

Serious?

We have code review,  we have some many ways for communication, even revert
a commit if needed.

That is not how open source works,  sad to say that for you twice this
year.

Please revert it, it is bad for the community and for FreeBSD.  Everybody
can read the svn history.

Best,


More information about the svn-src-head mailing list