Index: uspace/lib/libc/generic/vfs.c
===================================================================
--- uspace/lib/libc/generic/vfs.c	(revision 5973fd0e3fba22d883e191eaf2eb0c640098d526)
+++ uspace/lib/libc/generic/vfs.c	(revision a7df23cc504e88bc6a076157a13a72a4666c26d9)
@@ -96,6 +96,5 @@
 }
 
-
-int open(const char *path, int oflag, ...)
+static int _open(const char *path, int lflag, int oflag, ...)
 {
 	int res;
@@ -114,5 +113,5 @@
 		}
 	}
-	req = async_send_2(vfs_phone, VFS_OPEN, oflag, 0, &answer);
+	req = async_send_3(vfs_phone, VFS_OPEN, lflag, oflag, 0, &answer);
 	rc = ipc_data_write_start(vfs_phone, path, strlen(path));
 	if (rc != EOK) {
@@ -126,4 +125,9 @@
 	futex_up(&vfs_phone_futex);
 	return (int) IPC_GET_ARG1(answer);
+}
+
+int open(const char *path, int oflag, ...)
+{
+	return _open(path, L_FILE, oflag);
 }
 
@@ -243,5 +247,5 @@
 	if (!dirp)
 		return NULL;
-	dirp->fd = open(dirname, 0);	/* TODO: must be a directory */
+	dirp->fd = _open(dirname, L_DIRECTORY, 0);
 	if (dirp->fd < 0) {
 		free(dirp);
Index: uspace/srv/fs/tmpfs/tmpfs_ops.c
===================================================================
--- uspace/srv/fs/tmpfs/tmpfs_ops.c	(revision 5973fd0e3fba22d883e191eaf2eb0c640098d526)
+++ uspace/srv/fs/tmpfs/tmpfs_ops.c	(revision a7df23cc504e88bc6a076157a13a72a4666c26d9)
@@ -237,4 +237,5 @@
 	unsigned last = IPC_GET_ARG2(*request);
 	int dev_handle = IPC_GET_ARG3(*request);
+	int lflag = IPC_GET_ARG4(*request);
 
 	if (last < next)
Index: uspace/srv/vfs/vfs.h
===================================================================
--- uspace/srv/vfs/vfs.h	(revision 5973fd0e3fba22d883e191eaf2eb0c640098d526)
+++ uspace/srv/vfs/vfs.h	(revision a7df23cc504e88bc6a076157a13a72a4666c26d9)
@@ -139,4 +139,7 @@
 } vfs_triplet_t;
 
+#define L_FILE		1
+#define L_DIRECTORY	2
+
 typedef struct {
 	vfs_triplet_t triplet;
@@ -204,5 +207,5 @@
 extern int fs_name_to_handle(char *, bool);
 
-extern int vfs_lookup_internal(char *, size_t, vfs_lookup_res_t *,
+extern int vfs_lookup_internal(char *, size_t, int, vfs_lookup_res_t *,
     vfs_pair_t *);
 
Index: uspace/srv/vfs/vfs_lookup.c
===================================================================
--- uspace/srv/vfs/vfs_lookup.c	(revision 5973fd0e3fba22d883e191eaf2eb0c640098d526)
+++ uspace/srv/vfs/vfs_lookup.c	(revision a7df23cc504e88bc6a076157a13a72a4666c26d9)
@@ -56,4 +56,5 @@
  * @param path		Path to be resolved; it needn't be an ASCIIZ string.
  * @param len		Number of path characters pointed by path.
+ * @param lflag		Flags to be used during lookup.
  * @param result	Empty structure where the lookup result will be stored.
  * @param altroot	If non-empty, will be used instead of rootfs as the root
@@ -62,6 +63,6 @@
  * @return		EOK on success or an error code from errno.h.
  */
-int vfs_lookup_internal(char *path, size_t len, vfs_lookup_res_t *result,
-    vfs_pair_t *altroot)
+int vfs_lookup_internal(char *path, size_t len, int lflag,
+    vfs_lookup_res_t *result, vfs_pair_t *altroot)
 {
 	vfs_pair_t *root;
@@ -145,7 +146,7 @@
 	ipc_call_t answer;
 	int phone = vfs_grab_phone(root->fs_handle);
-	aid_t req = async_send_3(phone, VFS_LOOKUP, (ipcarg_t) first,
+	aid_t req = async_send_4(phone, VFS_LOOKUP, (ipcarg_t) first,
 	    (ipcarg_t) (first + len - 1) % PLB_SIZE,
-	    (ipcarg_t) root->dev_handle, &answer);
+	    (ipcarg_t) root->dev_handle, (ipcarg_t) lflag, &answer);
 	vfs_release_phone(phone);
 
Index: uspace/srv/vfs/vfs_ops.c
===================================================================
--- uspace/srv/vfs/vfs_ops.c	(revision 5973fd0e3fba22d883e191eaf2eb0c640098d526)
+++ uspace/srv/vfs/vfs_ops.c	(revision a7df23cc504e88bc6a076157a13a72a4666c26d9)
@@ -72,5 +72,6 @@
 	};
 
-	return vfs_lookup_internal("/", strlen("/"), result, &altroot);
+	return vfs_lookup_internal("/", strlen("/"), L_DIRECTORY, result,
+	    &altroot);
 }
 
@@ -196,5 +197,6 @@
 		 */
 		rwlock_write_lock(&namespace_rwlock);
-		rc = vfs_lookup_internal(buf, size, &mp_res, NULL);
+		rc = vfs_lookup_internal(buf, size, L_DIRECTORY, &mp_res,
+		    NULL);
 		if (rc != EOK) {
 			/*
@@ -298,10 +300,14 @@
 
 	/*
-	 * The POSIX interface is open(path, flags, mode).
-	 * We can receive flags and mode along with the VFS_OPEN call; the path
+	 * The POSIX interface is open(path, oflag, mode).
+	 * We can receive oflags and mode along with the VFS_OPEN call; the path
 	 * will need to arrive in another call.
-	 */
-	int flags = IPC_GET_ARG1(*request);
-	int mode = IPC_GET_ARG2(*request);
+	 *
+	 * We also receive one private, non-POSIX set of flags called lflag
+	 * used to pass information to vfs_lookup_internal().
+	 */
+	int lflag = IPC_GET_ARG1(*request);
+	int oflag = IPC_GET_ARG2(*request);
+	int mode = IPC_GET_ARG3(*request);
 	size_t len;
 
@@ -346,5 +352,5 @@
 	 */
 	vfs_lookup_res_t lr;
-	rc = vfs_lookup_internal(path, len, &lr, NULL);
+	rc = vfs_lookup_internal(path, len, lflag, &lr, NULL);
 	if (rc) {
 		rwlock_read_unlock(&namespace_rwlock);
