Index: uspace/lib/c/generic/vfs/vfs.c
===================================================================
--- uspace/lib/c/generic/vfs/vfs.c	(revision 0b97336d11bcc58a2ceb2de62e7d789187fda193)
+++ uspace/lib/c/generic/vfs/vfs.c	(revision 38aaf00508acfd26f9d005fe19c221720104ca88)
@@ -388,10 +388,11 @@
 int open(const char *path, 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);
+	if (((oflag & (O_RDONLY | O_WRONLY | O_RDWR)) == 0) ||
+	    ((oflag & (O_RDONLY | O_WRONLY)) == (O_RDONLY | O_WRONLY)) ||
+	    ((oflag & (O_RDONLY | O_RDWR)) == (O_RDONLY | O_RDWR)) ||
+	    ((oflag & (O_WRONLY | O_RDWR)) == (O_WRONLY | O_RDWR))) {
+		errno = EINVAL;
+		return -1;
+	}
 	
 	int fd = vfs_lookup(path, walk_flags(oflag) | WALK_REGULAR);
