Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Feb 2015 00:21:55 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r278649 - head/lib/libc/gen
Message-ID:  <201502130021.t1D0LtAc001129@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pfg
Date: Fri Feb 13 00:21:54 2015
New Revision: 278649
URL: https://svnweb.freebsd.org/changeset/base/278649

Log:
  Revert 278634: This broke the build due to the compiler being too clever.
  
  Will be back, with proper compiler workarounds.

Modified:
  head/lib/libc/gen/ulimit.c

Modified: head/lib/libc/gen/ulimit.c
==============================================================================
--- head/lib/libc/gen/ulimit.c	Fri Feb 13 00:17:22 2015	(r278648)
+++ head/lib/libc/gen/ulimit.c	Fri Feb 13 00:21:54 2015	(r278649)
@@ -53,13 +53,13 @@ ulimit(int cmd, ...)
 		va_start(ap, cmd);
 		arg = va_arg(ap, long);
 		va_end(ap);
-		if (arg > RLIM_INFINITY / 512 || arg < 0)
-			arg = RLIM_INFINITY / 512;
 		limit.rlim_max = limit.rlim_cur = (rlim_t)arg * 512;
 
 		/* The setrlimit() function sets errno to EPERM if needed. */
 		if (setrlimit(RLIMIT_FSIZE, &limit) == -1)
 			return (-1);
+		if (arg * 512 > LONG_MAX)
+			return (LONG_MAX);
 		return (arg);
 	} else {
 		errno = EINVAL;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201502130021.t1D0LtAc001129>