2.4.18 kernel lseek() bug
Quoted 3 lines
a call to
lseek()fails with EINVAL under the following conditions:
- it is called on a disk device file
- required offset is larger than the target disk device size
Is this behaviour mandated in a standard, or is it just different from previous behaviour? I'm not saying it _isn't_ a bug, but I don't see how seeking past the end of a block device is very useful.
I know many programs that use this. They seek and do not expect an error, because the standard says no error is to be expected, and then try to read or write.
Let me quote POSIX 1003.1-2001.
...
The lseek() function shall allow the file offset to be set beyond the end of the existing data in the file.
...
[EINVAL]
The whence argument is not a proper value, or the resulting file offset would be negative for a regular file, block special file, or directory.
Andries