Index: uspace/app/tester/vfs/vfs1.c
===================================================================
--- uspace/app/tester/vfs/vfs1.c	(revision 15b9970755facf113d63730929254f4399453ee0)
+++ uspace/app/tester/vfs/vfs1.c	(revision f701757241001e95d2e9f1d206c98c30138347ab)
@@ -39,4 +39,7 @@
 #include "../tester.h"
 
+char text[] = "O xein', angellein Lakedaimoniois hoti teide "
+	"keimetha tois keinon rhemasi peithomenoi.";
+
 char *test_vfs1(bool quiet)
 {
@@ -46,4 +49,22 @@
 	if (mkdir("/mydir", 0) != 0)
 		return "mkdir() failed.\n";
+	if (!quiet)
+		printf("Created directory /mydir\n");
+	
+	int fd0 = open("/mydir/myfile", O_CREAT);
+	if (fd0 < 0)
+		return "open() failed.\n";
+	if (!quiet)
+		printf("Created /mydir/myfile, handle=%d\n", fd0);
+
+	ssize_t cnt;
+	size_t size = sizeof(text);
+	cnt = write(fd0, text, size);
+	if (cnt < 0)
+		return "write() failed.\n";
+	if (!quiet)
+		printf("Written %d btyes to handle %d.\n", cnt, fd0);
+	if (lseek(fd0, 0, SEEK_SET) != 0)
+		return "lseek() failed.\n";
 
 	DIR *dirp;
@@ -57,6 +78,6 @@
 	closedir(dirp);
 
-	int fd1 = open("/dir1/file1", 0);
-	int fd2 = open("/dir2/file2", 0);
+	int fd1 = open("/dir1/file1", O_RDONLY);
+	int fd2 = open("/dir2/file2", O_RDONLY);
 
 	if (fd1 < 0)
@@ -70,10 +91,19 @@
 	char buf[10];
 
-	ssize_t cnt = read(fd1, buf, sizeof(buf));
+	cnt = read(fd0, buf, sizeof(buf));
 	if (cnt < 0)
 		return "read() failed.\n";
 
 	if (!quiet)
-		printf("Read %d bytes: %.*s\n", cnt, cnt, buf);
+		printf("Read %d bytes from handle %d: %.*s\n", cnt, fd0, cnt,
+		    buf);
+
+	cnt = read(fd1, buf, sizeof(buf));
+	if (cnt < 0)
+		return "read() failed.\n";
+
+	if (!quiet)
+		printf("Read %d bytes from handle %d: %.*s\n", cnt, fd1, cnt,
+		    buf);
 
 	return NULL;
Index: uspace/lib/libc/generic/vfs.c
===================================================================
--- uspace/lib/libc/generic/vfs.c	(revision 15b9970755facf113d63730929254f4399453ee0)
+++ uspace/lib/libc/generic/vfs.c	(revision f701757241001e95d2e9f1d206c98c30138347ab)
@@ -166,5 +166,8 @@
 	async_serialize_end();
 	futex_up(&vfs_phone_futex);
-	return (ssize_t) IPC_GET_ARG1(answer);
+	if (rc == EOK)
+		return (ssize_t) IPC_GET_ARG1(answer);
+	else
+		return -1;
 }
 
@@ -196,5 +199,8 @@
 	async_serialize_end();
 	futex_up(&vfs_phone_futex);
-	return (ssize_t) IPC_GET_ARG1(answer);
+	if (rc == EOK)
+		return (ssize_t) IPC_GET_ARG1(answer);
+	else
+		return -1;
 }
 
Index: uspace/srv/fs/tmpfs/tmpfs.c
===================================================================
--- uspace/srv/fs/tmpfs/tmpfs.c	(revision 15b9970755facf113d63730929254f4399453ee0)
+++ uspace/srv/fs/tmpfs/tmpfs.c	(revision f701757241001e95d2e9f1d206c98c30138347ab)
@@ -116,4 +116,7 @@
 			tmpfs_read(callid, &call);
 			break;
+		case VFS_WRITE:
+			tmpfs_write(callid, &call);
+			break;
 		default:
 			ipc_answer_0(callid, ENOTSUP);
Index: uspace/srv/fs/tmpfs/tmpfs_ops.c
===================================================================
--- uspace/srv/fs/tmpfs/tmpfs_ops.c	(revision 15b9970755facf113d63730929254f4399453ee0)
+++ uspace/srv/fs/tmpfs/tmpfs_ops.c	(revision f701757241001e95d2e9f1d206c98c30138347ab)
@@ -498,5 +498,5 @@
 		/* The file size is not changing. */
 		(void) ipc_data_write_finalize(callid, dentry->data + pos, len);
-		ipc_answer_1(rid, EOK, len);
+		ipc_answer_2(rid, EOK, len, dentry->size);
 		return;
 	}
@@ -512,5 +512,5 @@
 	if (!newdata) {
 		ipc_answer_0(callid, ENOMEM);
-		ipc_answer_1(rid, EOK, 0);
+		ipc_answer_2(rid, EOK, 0, dentry->size);
 		return;
 	}
Index: uspace/srv/vfs/vfs_ops.c
===================================================================
--- uspace/srv/vfs/vfs_ops.c	(revision 15b9970755facf113d63730929254f4399453ee0)
+++ uspace/srv/vfs/vfs_ops.c	(revision f701757241001e95d2e9f1d206c98c30138347ab)
@@ -371,5 +371,5 @@
 	vfs_file_t *file = vfs_file_get(fd);
 	file->node = node;
-	if (oflag & O_APPEND)
+	if (oflag & O_APPEND) 
 		file->append = true;
 
@@ -471,10 +471,12 @@
 	else {
 		/* Update the cached version of node's size. */
-		file->node->size = IPC_GET_ARG2(answer); 
+		if (rc == EOK)
+			file->node->size = IPC_GET_ARG2(answer); 
 		rwlock_write_unlock(&file->node->contents_rwlock);
 	}
 
 	/* Update the position pointer and unlock the open file. */
-	file->pos += bytes;
+	if (rc == EOK)
+		file->pos += bytes;
 	futex_up(&file->lock);
 
