patch-1.3.44 linux/fs/fcntl.c

Next file: linux/fs/isofs/inode.c
Previous file: linux/drivers/pci/pci.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.43/linux/fs/fcntl.c linux/fs/fcntl.c
@@ -41,19 +41,9 @@
 		return -EBADF;
 	if (newfd == oldfd)
 		return newfd;
-	/*
-	 * errno's for dup2() are slightly different than for fcntl(F_DUPFD)
-	 * for historical reasons.
-	 */
-	if (newfd > NR_OPEN)	/* historical botch - should have been >= */
-		return -EBADF;	/* dupfd() would return -EINVAL */
-#if 1
-	if (newfd == NR_OPEN)
-		return -EBADF;	/* dupfd() does return -EINVAL and that may
-				 * even be the standard!  But that is too
-				 * weird for now.
-				 */
-#endif
+	if (newfd >= NR_OPEN)
+		return -EBADF;	/* following POSIX.1 6.2.1 */
+
 	sys_close(newfd);
 	return dupfd(oldfd,newfd);
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this