Check error return from _parse_off_t(), and remove cruft from the 2->3 transition.

This commit is contained in:
Antoine Pitrou 2011-02-26 13:38:35 +00:00
parent 09c530dfc8
commit dcc20b8563
1 changed files with 4 additions and 5 deletions

View File

@ -369,8 +369,7 @@ _parse_off_t(PyObject* arg, void* addr)
#if !defined(HAVE_LARGEFILE_SUPPORT) #if !defined(HAVE_LARGEFILE_SUPPORT)
*((off_t*)addr) = PyLong_AsLong(arg); *((off_t*)addr) = PyLong_AsLong(arg);
#else #else
*((off_t*)addr) = PyLong_Check(arg) ? PyLong_AsLongLong(arg) *((off_t*)addr) = PyLong_AsLongLong(arg);
: PyLong_AsLong(arg);
#endif #endif
if (PyErr_Occurred()) if (PyErr_Occurred())
return 0; return 0;
@ -5772,8 +5771,7 @@ posix_lseek(PyObject *self, PyObject *args)
#if !defined(HAVE_LARGEFILE_SUPPORT) #if !defined(HAVE_LARGEFILE_SUPPORT)
pos = PyLong_AsLong(posobj); pos = PyLong_AsLong(posobj);
#else #else
pos = PyLong_Check(posobj) ? pos = PyLong_AsLongLong(posobj);
PyLong_AsLongLong(posobj) : PyLong_AsLong(posobj);
#endif #endif
if (PyErr_Occurred()) if (PyErr_Occurred())
return NULL; return NULL;
@ -6030,7 +6028,8 @@ done:
return Py_BuildValue("nO", ret, Py_None); return Py_BuildValue("nO", ret, Py_None);
} }
#endif #endif
_parse_off_t(offobj, &offset); if (!_parse_off_t(offobj, &offset))
return NULL;
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
ret = sendfile(out, in, &offset, count); ret = sendfile(out, in, &offset, count);
Py_END_ALLOW_THREADS Py_END_ALLOW_THREADS