Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20171215022809.GF1627@brightrain.aerifal.cx>
Date: Thu, 14 Dec 2017 21:28:09 -0500
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: [PATCH] fix sysconf for inifinite rlimits

On Thu, Dec 07, 2017 at 11:18:54PM +0100, Natanael Copa wrote:
> sysconf should return -1 for infinity, not LONG_MAX.
> ---
>  src/conf/sysconf.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/src/conf/sysconf.c b/src/conf/sysconf.c
> index b8b761d0..9ce330a5 100644
> --- a/src/conf/sysconf.c
> +++ b/src/conf/sysconf.c
> @@ -174,6 +174,8 @@ long sysconf(int name)
>  	} else if (values[name] < -256) {
>  		struct rlimit lim;
>  		getrlimit(values[name]&16383, &lim);
> +		if (lim.rlim_cur == RLIM_INFINITY)
> +			return -1;
>  		return lim.rlim_cur > LONG_MAX ? LONG_MAX : lim.rlim_cur;
>  	}
>  
> -- 
> 2.15.0

Thanks. Committing with typo fix. ;-)

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.