[PATCH] fclose: avoid double close race when possible

2011-05-10 Thread Eric Blake
Calling close(fileno(fp)) prior to fclose(fp) is racy in a multi-threaded application - some other thread could open a new file, which is then inadvertently closed by the fclose that we thought should fail with EBADF. For mingw, this is no worse than the race already present in close_fd_maybe_sock

Re: [PATCH] maint.mk: prohibit use of "can not"

2011-05-10 Thread Eric Blake
On 04/09/2011 03:02 PM, Jim Meyering wrote: > There was a new use of "can not" in coreutils despite > my having performed this transformation before. > Autoconf is the same: one current/new violation, > in spite of applying the fix before. > I noticed that James Youngman recently fixed one in findu

Re: proposed new module intprops-test

2011-05-10 Thread Paul Eggert
On 05/10/11 10:07, Eric Blake wrote: > ./gnulib-tool --with-tests --test intprops Thanks, I ran that and it worked. > verify (! TYPE_IS_INTEGER (void *)); No, TYPE_IS_INTEGER is defined only for arithmetic types, so I left that alone. > verify (TYPE_SIGNED (double)); Thanks, I added that (see

Re: proposed new module intprops-test

2011-05-10 Thread Eric Blake
On 05/10/2011 10:57 AM, Paul Eggert wrote: > Here's a proposed module to test 'intprops'. It assumes the revised > patch for integer overflow checking that I emailed a few minutes ago. > > I don't know the recommended way to test this with gnulib-tool; > I read the --help output and the documenta

proposed new module intprops-test

2011-05-10 Thread Paul Eggert
Here's a proposed module to test 'intprops'. It assumes the revised patch for integer overflow checking that I emailed a few minutes ago. I don't know the recommended way to test this with gnulib-tool; I read the --help output and the documentation, but couldn't figure it out. I tested it by han

Re: proposed new module intoverflow

2011-05-10 Thread Paul Eggert
On 05/06/11 03:41, Bruno Haible wrote: >ADD_OVERFLOW (a, b, unsigned int) > is easier to write and understand than >ADD_OVERFLOW (a, b, 0, UINT_MAX) OK, but "ADD_OVERFLOW (a, b)" is easier yet, no? And this would address Ben's comment that the macro should check the types of the arguments

Re: [PATCH] openat: reduce syscalls in first probe of /proc

2011-05-10 Thread Jim Meyering
Jim Meyering wrote: > Bastien ROUCARIES wrote: > >> I disagree here: >>>       else >>>         { >>> +          /* Detect whether /proc/self/fd/../fd exists.  On Linux, that >>> name >>> +             resolves to /proc/self/fd, which was opened above.  However, >>> on >>> +             Solaris,

Re: [PATCH] openat: reduce syscalls in first probe of /proc

2011-05-10 Thread Jim Meyering
Bastien ROUCARIES wrote: > I disagree here: >>       else >>         { >> +          /* Detect whether /proc/self/fd/../fd exists.  On Linux, that name >> +             resolves to /proc/self/fd, which was opened above.  However, on >> +             Solaris, it may resolve to /proc/self/fd/fd, whi

Re: [PATCH] openat: reduce syscalls in first probe of /proc

2011-05-10 Thread Bastien ROUCARIES
I disagree here: >       else >         { > +          /* Detect whether /proc/self/fd/../fd exists.  On Linux, that name > +             resolves to /proc/self/fd, which was opened above.  However, on > +             Solaris, it may resolve to /proc/self/fd/fd, which cannot exist, > +            

Re: [PATCH] openat: reduce syscalls in first probe of /proc

2011-05-10 Thread Jim Meyering
Eric Blake wrote: > open/access/close is cheaper than open/stat/stat/close. > > * lib/openat-proc.c (openat_proc_name): Simplify. > * modules/openat (Depends-on): Drop same-inode. > Reported by Bastien ROUCARIES. ... > diff --git a/lib/openat-proc.c b/lib/openat-proc.c ... > @@ -80,15 +79,9 @@ open