patch-1.3.67 linux/fs/pipe.c

Next file: linux/fs/sysv/file.c
Previous file: linux/fs/nfs/proc.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.66/linux/fs/pipe.c linux/fs/pipe.c
@@ -254,8 +254,10 @@
 
 static void pipe_rdwr_release(struct inode * inode, struct file * filp)
 {
-	PIPE_READERS(*inode)--;
-	PIPE_WRITERS(*inode)--;
+	if (filp->f_mode & FMODE_READ)
+		PIPE_READERS(*inode)--;
+	if (filp->f_mode & FMODE_WRITE)
+		PIPE_WRITERS(*inode)--;
 	wake_up_interruptible(&PIPE_WAIT(*inode));
 }
 
@@ -273,8 +275,10 @@
 
 static int pipe_rdwr_open(struct inode * inode, struct file * filp)
 {
-	PIPE_READERS(*inode)++;
-	PIPE_WRITERS(*inode)++;
+	if (filp->f_mode & FMODE_READ)
+		PIPE_READERS(*inode)++;
+	if (filp->f_mode & FMODE_WRITE)
+		PIPE_WRITERS(*inode)++;
 	return 0;
 }
 

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