diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index d8824221f..bfc0329aa 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2013-05-01 Christopher Faylor + + * resource.cc (setrlimit): Use consistent commenting style. Return + EINVAL when rlim_cur > rlim_max. + 2013-04-30 Yaakov Selkowitz Throughout, (mainly in fhandler*) fix remaining gcc 4.7 mismatch diff --git a/winsup/cygwin/resource.cc b/winsup/cygwin/resource.cc index 97a9dff23..15ca2208a 100644 --- a/winsup/cygwin/resource.cc +++ b/winsup/cygwin/resource.cc @@ -1,7 +1,7 @@ /* resource.cc: getrusage () and friends. Copyright 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2005, 2008, 2009, 2010, - 2011, 2012 Red Hat, Inc. + 2011, 2012, 2013 Red Hat, Inc. Written by Steve Chamberlain (sac@cygnus.com), Doug Evans (dje@cygnus.com), Geoffrey Noer (noer@cygnus.com) of Cygnus Support. @@ -167,17 +167,22 @@ setrlimit (int resource, const struct rlimit *rlp) struct rlimit oldlimits; - // Check if the request is to actually change the resource settings. - // If it does not result in a change, take no action and do not - // fail. + /* Check if the request is to actually change the resource settings. + If it does not result in a change, take no action and do not fail. */ if (getrlimit (resource, &oldlimits) < 0) return -1; if (oldlimits.rlim_cur == rlp->rlim_cur && oldlimits.rlim_max == rlp->rlim_max) - // No change in resource requirements, succeed immediately + /* No change in resource requirements, succeed immediately */ return 0; + if (rlp->rlim_cur > rlp->rlim_max) + { + set_errno (EINVAL); + return -1; + } + switch (resource) { case RLIMIT_CORE: