Re: RLIMIT_NOFILE fallback

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Dec 18, 2013 at 01:37:24PM -0800, Junio C Hamano wrote:

> Jeff King <peff@xxxxxxxx> writes:
> 
> > According to the POSIX quote above, it sounds like we could do:
> >
> >   #if defined (_SC_OPEN_MAX)
> >   {
> >           long max;
> >           errno = 0;
> >           max = sysconf(_SC_OPEN_MAX);
> >           if (0 < max) /* got the limit */
> >                   return max;
> >           else if (!errno) /* unlimited, cast to int-max */
> >                   return max;
> >           /* otherwise, fall through */
> >   }
> >   #endif
> >
> > Obviously you could collapse the two branches of the conditional, though
> > I think it deserves at least a comment to explain what is going on.
> 
> Yes, that is locally OK, but depending on how the caller behaves, we
> might need to have an extra saved_errno dance here, which I didn't
> want to get into...

I think we are fine. The only caller is about to clobber errno by
closing packs anyway.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]