patch-2.1.47 linux/fs/minix/file.c

Next file: linux/fs/minix/namei.c
Previous file: linux/fs/minix/dir.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.46/linux/fs/minix/file.c linux/fs/minix/file.c
@@ -108,7 +108,13 @@
 			}
 		}
 		p = (pos % BLOCK_SIZE) + bh->b_data;
-		copy_from_user(p,buf,c);
+		c -= copy_from_user(p,buf,c);
+		if (!c) {
+			brelse(bh);
+			if (!written)
+				written = -EFAULT;
+			break;
+		}
 		update_vm_cache(inode, pos, p, c);
 		mark_buffer_uptodate(bh, 1);
 		mark_buffer_dirty(bh, 0);

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