patch-2.1.32 linux/fs/autofs/waitq.c

Next file: linux/fs/binfmt_em86.c
Previous file: linux/fs/autofs/symlink.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.31/linux/fs/autofs/waitq.c linux/fs/autofs/waitq.c
@@ -10,8 +10,9 @@
  *
  * ------------------------------------------------------------------------- */
 
-#include <linux/modversions.h>
 #include <linux/malloc.h>
+#include <linux/signal.h>
+#include <linux/sched.h>
 #include <linux/auto_fs.h>
 
 /* We make this a static variable rather than a part of the superblock; it
@@ -40,6 +41,7 @@
 static int autofs_write(struct file *file, const void *addr, int bytes)
 {
 	unsigned short fs;
+	unsigned long old_signal;
 	const char *data = (const char *)addr;
 	int written;
 
@@ -49,9 +51,17 @@
 	fs = get_fs();
 	set_fs(KERNEL_DS);
 
+	old_signal = current->signal;
+
 	while ( bytes && (written = file->f_op->write(file->f_inode,file,data,bytes)) > 0 ) {
 		data += written;
 		bytes -= written;
+	}
+
+	if ( written == -EPIPE && !(old_signal & (1 << (SIGPIPE-1))) ) {
+		/* Keep the currently executing process from receiving a
+		   SIGPIPE unless it was already supposed to get one */
+		current->signal &= ~(1 << (SIGPIPE-1));
 	}
 	set_fs(fs);
 

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