bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

pread()


From: Manuel Menal
Subject: pread()
Date: Sat, 09 Oct 2010 20:40:26 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.12) Gecko/20100918 Icedove/3.0.8

Hello,

It seems the Hurd implementation of pread() is not POSIX-compliant.
POSIX stipulates that "An attempt to perform a pread() on a file that is
incapable of seeking shall result in an error"[0]. But the Hurd pread()
ignores the offset parameter.

The reason is quite simple: pread() passes the offset parameter to
io_read(), which is supposed[1] to ignore it when the object is not
seekable. So pread() can't know that the offset was ignored and behaves
incorrectly.

There should be a way to check if the object is seekable or not before
calling io_read(), so pread() can return an error. But there is no
io_seekable() RPC, and calling io_seek() seems wrong to me, since
pread() is supposed not to change the file offset.

Any idea?

[0]: http://www.opengroup.org/onlinepubs/009695399/functions/read.html
[1]: According to the Hurd Reference Manual and to <hurd/io.defs>.

-- 
Manuel Menal

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]