svn commit: r278649 - head/lib/libc/gen

Pedro F. Giffuni pfg at FreeBSD.org
Fri Feb 13 00:21:55 UTC 2015


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;


More information about the svn-src-all mailing list