PERFORCE change 106539 for review
Roman Divacky
rdivacky at FreeBSD.org
Sat Sep 23 02:15:49 PDT 2006
http://perforce.freebsd.org/chv.cgi?CH=106539
Change 106539 by rdivacky at rdivacky_witten on 2006/09/23 09:14:44
Return EISDIR in pread() when arg is a directory.
Affected files ...
.. //depot/projects/linuxolator/src/sys/compat/linux/linux_file.c#3 edit
Differences ...
==== //depot/projects/linuxolator/src/sys/compat/linux/linux_file.c#3 (text+ko) ====
@@ -724,12 +724,28 @@
struct linux_pread_args *uap;
{
struct pread_args bsd;
+ struct vnode *vp;
+ int error;
bsd.fd = uap->fd;
bsd.buf = uap->buf;
bsd.nbyte = uap->nbyte;
bsd.offset = uap->offset;
- return pread(td, &bsd);
+
+ error = pread(td, &bsd);
+
+ if (error == 0) {
+ /* This seems to violate POSIX but linux does it */
+ if ((error = fgetvp(td, uap->fd, &vp)) != 0)
+ return (error);
+ if (vp->v_type == VDIR) {
+ vrele(vp);
+ return (EISDIR);
+ }
+ vrele(vp);
+ }
+
+ return (error);
}
int
More information about the p4-projects
mailing list