Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 Sep 2006 09:15:42 GMT
From:      Roman Divacky <rdivacky@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 106539 for review
Message-ID:  <200609230915.k8N9Fg0C041815@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=106539

Change 106539 by rdivacky@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200609230915.k8N9Fg0C041815>