Mailing List Archive

python/dist/src/Modules resource.c,2.24,2.25
Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv4408/Modules

Modified Files:
resource.c
Log Message:
Check for overflow errors in setrlimit(),
and reflow a long line.


Index: resource.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/resource.c,v
retrieving revision 2.24
retrieving revision 2.25
diff -C2 -d -r2.24 -r2.25
*** resource.c 8 Apr 2002 21:28:20 -0000 2.24
--- resource.c 23 Apr 2002 20:15:04 -0000 2.25
***************
*** 143,147 ****
PyObject *curobj, *maxobj;

! if (!PyArg_ParseTuple(args, "i(OO):setrlimit", &resource, &curobj, &maxobj))
return NULL;

--- 143,148 ----
PyObject *curobj, *maxobj;

! if (!PyArg_ParseTuple(args, "i(OO):setrlimit",
! &resource, &curobj, &maxobj))
return NULL;

***************
*** 154,164 ****
--- 155,173 ----
#if !defined(HAVE_LARGEFILE_SUPPORT)
rl.rlim_cur = PyInt_AsLong(curobj);
+ if (rl.rlim_cur == -1 && PyErr_Occurred())
+ return NULL;
rl.rlim_max = PyInt_AsLong(maxobj);
+ if (rl.rlim_max == -1 && PyErr_Occurred())
+ return NULL;
#else
/* The limits are probably bigger than a long */
rl.rlim_cur = PyLong_Check(curobj) ?
PyLong_AsLongLong(curobj) : PyInt_AsLong(curobj);
+ if (rl.rlim_cur == -1 && PyErr_Occurred())
+ return NULL;
rl.rlim_max = PyLong_Check(maxobj) ?
PyLong_AsLongLong(maxobj) : PyInt_AsLong(maxobj);
+ if (rl.rlim_max == -1 && PyErr_Occurred())
+ return NULL;
#endif