[issue12545] Incorrect handling of return codes in the posix_lseek function in posixmodule.c

STINNER Victor report at bugs.python.org
Wed Jul 13 15:08:28 CEST 2011


STINNER Victor <victor.stinner at haypocalc.com> added the comment:

"... A negative file offset may be valid for some devices in some implementations.

The POSIX.1-1990 standard did not specifically prohibit lseek() from returning a negative offset. Therefore, an application was required to clear errno prior to the call and check errno upon return to determine whether a return value of ( off_t)-1 is a negative offset or an indication of an error condition. The standard developers did not wish to require this action on the part of a conforming application, and chose to require that errno be set to [EINVAL] when the resulting file offset would be negative for a regular file, block special file, or directory."

Extract of:
http://pubs.opengroup.org/onlinepubs/009695399/functions/lseek.html

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12545>
_______________________________________


More information about the Python-bugs-list mailing list