Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2013-05-02 01:19:51 +0400
committerChristopher Faylor <me@cgf.cx>2013-05-02 01:19:51 +0400
commit0cfce9acc954315c359fd1c80079f4e3419dd461 (patch)
treee28de7b88977922f2a3d38585d514142c124c3c2 /winsup/cygwin/resource.cc
parent1f36328e7f31694b422c29881c17e957265d8344 (diff)
* resource.cc (setrlimit): Use consistent commenting style. Return EINVAL when
rlim_cur > rlim_max.
Diffstat (limited to 'winsup/cygwin/resource.cc')
-rw-r--r--winsup/cygwin/resource.cc15
1 files changed, 10 insertions, 5 deletions
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: