exit 9p on interrupt signal.  should do better job here.
diff --git a/src/cmd/9p.c b/src/cmd/9p.c
index e6646b7..9a5aa67 100644
--- a/src/cmd/9p.c
+++ b/src/cmd/9p.c
@@ -1,4 +1,5 @@
 #include <u.h>
+#include <signal.h>
 #include <libc.h>
 #include <fcall.h>
 #include <fs.h>
@@ -54,6 +55,8 @@
 		usage();
 	}ARGEND
 
+	signal(SIGINT, SIG_DFL);
+
 	if(argc < 1)
 		usage();
 
@@ -180,7 +183,7 @@
 xwrite(int argc, char **argv)
 {
 	char buf[1024];
-	int n;
+	int n, did;
 	Fid *fid;
 
 	ARGBEGIN{
@@ -191,10 +194,17 @@
 	if(argc != 1)
 		usage();
 
+	did = 0;
 	fid = xopen(argv[0], OWRITE|OTRUNC);
-	while((n = read(0, buf, sizeof buf)) > 0)
+	while((n = read(0, buf, sizeof buf)) > 0){
+		did = 1;
 		if(fswrite(fid, buf, n) != n)
 			sysfatal("write error: %r");
+	}
+	if(n == 0 && !did){
+		if(fswrite(fid, buf, 0) != 0)
+			sysfatal("write error: %r");
+	}
 	if(n < 0)
 		sysfatal("read error: %r");
 	exits(0);