Re: 2.4.18 kernel lseek() bug

From: Andries.Brouwer@cwi.nl
Date: Sat Jun 15 2002 - 09:20:11 EST


> 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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Jun 15 2002 - 22:00:33 EST