Index: uspace/lib/c/generic/vfs/vfs.c
===================================================================
--- uspace/lib/c/generic/vfs/vfs.c	(revision 0b18364c6fa42d415600ee3c44b15f8f5ad21769)
+++ uspace/lib/c/generic/vfs/vfs.c	(revision 9a8c18898eabd87ac69292b3de0fb8425bb0bba8)
@@ -329,4 +329,11 @@
 static int open_internal(const char *abs, size_t abs_size, int lflag, int oflag)
 {
+	// FIXME: Some applications call this incorrectly.
+	if ((oflag & (O_RDONLY|O_WRONLY|O_RDWR)) == 0) {
+		oflag |= O_RDWR;
+	}
+
+	assert((((oflag & O_RDONLY) != 0) + ((oflag & O_WRONLY) != 0) + ((oflag & O_RDWR) != 0)) == 1);
+	
 	async_exch_t *exch = vfs_exchange_begin();
 	
Index: uspace/srv/vfs/vfs.c
===================================================================
--- uspace/srv/vfs/vfs.c	(revision 0b18364c6fa42d415600ee3c44b15f8f5ad21769)
+++ uspace/srv/vfs/vfs.c	(revision 9a8c18898eabd87ac69292b3de0fb8425bb0bba8)
@@ -89,5 +89,5 @@
 			break;
 		case VFS_IN_OPEN2:
-			vfs_open(callid, &call);
+			vfs_open2(callid, &call);
 			break;
 		case VFS_IN_OPEN:
Index: uspace/srv/vfs/vfs.h
===================================================================
--- uspace/srv/vfs/vfs.h	(revision 0b18364c6fa42d415600ee3c44b15f8f5ad21769)
+++ uspace/srv/vfs/vfs.h	(revision 9a8c18898eabd87ac69292b3de0fb8425bb0bba8)
@@ -228,5 +228,4 @@
 
 extern void vfs_walk(ipc_callid_t, ipc_call_t *);
-extern void vfs_create(ipc_callid_t, ipc_call_t *);
 extern void vfs_open2(ipc_callid_t, ipc_call_t *);
 
Index: uspace/srv/vfs/vfs_ops.c
===================================================================
--- uspace/srv/vfs/vfs_ops.c	(revision 0b18364c6fa42d415600ee3c44b15f8f5ad21769)
+++ uspace/srv/vfs/vfs_ops.c	(revision 9a8c18898eabd87ac69292b3de0fb8425bb0bba8)
@@ -767,4 +767,9 @@
 	}
 	
+	if ((((oflag & O_RDONLY) != 0) + ((oflag & O_WRONLY) != 0) + ((oflag & O_RDWR) != 0)) != 1) {
+		async_answer_0(rid, EINVAL);
+		return;
+	}
+	
 	if (oflag & O_CREAT)
 		lflag |= L_CREATE;
@@ -840,10 +845,6 @@
 	vfs_file_t *file = vfs_file_get(fd);
 	
-	/* There is a potential race with another fibril of a malicious client. */
-	if (!file) {
-		vfs_node_put(node);
-		async_answer_0(rid, EBUSY);
-		return;
-	}
+	/* FIXME: There is a potential race with another fibril of a malicious client. */
+	assert(file);
 	
 	file->node = node;
@@ -856,4 +857,5 @@
 	if (oflag & O_APPEND)
 		file->append = true;
+	assert(file->open_read || file->open_write);
 	
 	/*
