patch-2.1.91 linux/fs/pipe.c

Next file: linux/fs/proc/fd.c
Previous file: linux/fs/minix/truncate.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.90/linux/fs/pipe.c linux/fs/pipe.c
@@ -46,11 +46,12 @@
 	if (filp->f_flags & O_NONBLOCK) {
 		if (PIPE_LOCK(*inode))
 			return -EAGAIN;
-		if (PIPE_EMPTY(*inode))
+		if (PIPE_EMPTY(*inode)) {
 			if (PIPE_WRITERS(*inode))
 				return -EAGAIN;
 			else
 				return 0;
+		}
 	} else while (PIPE_EMPTY(*inode) || PIPE_LOCK(*inode)) {
 		if (PIPE_EMPTY(*inode)) {
 			if (!PIPE_WRITERS(*inode))
@@ -485,8 +486,9 @@
 	f2->f_flags = O_WRONLY;
 	f2->f_op = &write_pipe_fops;
 	f2->f_mode = 2;
-	current->files->fd[i] = f1;
-	current->files->fd[j] = f2;
+
+	fd_install(i, f1);
+	fd_install(j, f2);
 	fd[0] = i;
 	fd[1] = j;
 	return 0;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov