Index: uspace/app/bdsh/cmds/modules/cp/cp.c
===================================================================
--- uspace/app/bdsh/cmds/modules/cp/cp.c	(revision ea4a3f0c5835f2731a1049dce68c43238d2ec20a)
+++ uspace/app/bdsh/cmds/modules/cp/cp.c	(revision a6fc88aa460096502eae43ccce7f29d4eed95e58)
@@ -294,5 +294,6 @@
 				merge_paths(dest_path, PATH_MAX, src_dirname);
 
-				if (vfs_link_path(dest_path, KIND_DIRECTORY) != EOK) {
+				if (vfs_link_path(dest_path, KIND_DIRECTORY,
+				    NULL) != EOK) {
 					printf("Unable to create "
 					    "dest directory %s\n", dest_path);
@@ -308,5 +309,6 @@
 			 * e.g. cp -r /src /data/new_dir_src
 			 */
-			if (vfs_link_path(dest_path, KIND_DIRECTORY) != EOK) {
+			if (vfs_link_path(dest_path, KIND_DIRECTORY,
+			    NULL) != EOK) {
 				printf("Unable to create "
 				    "dest directory %s\n", dest_path);
Index: uspace/app/bdsh/cmds/modules/mkdir/mkdir.c
===================================================================
--- uspace/app/bdsh/cmds/modules/mkdir/mkdir.c	(revision ea4a3f0c5835f2731a1049dce68c43238d2ec20a)
+++ uspace/app/bdsh/cmds/modules/mkdir/mkdir.c	(revision a6fc88aa460096502eae43ccce7f29d4eed95e58)
@@ -96,5 +96,5 @@
 
 	if (!create_parents) {
-		ret = vfs_link_path(path, KIND_DIRECTORY);
+		ret = vfs_link_path(path, KIND_DIRECTORY, NULL);
 		if (ret != EOK) {
 			cli_error(CL_EFAIL, "%s: could not create %s (%s)",
@@ -135,5 +135,5 @@
 			path[prev_off] = 0;
 
-			ret = vfs_link_path(path, KIND_DIRECTORY);
+			ret = vfs_link_path(path, KIND_DIRECTORY, NULL);
 			if (ret != EOK && ret != EEXIST) {
 				cli_error(CL_EFAIL, "%s: could not create %s (%s)",
@@ -146,5 +146,5 @@
 		}
 		/* Create the final directory. */
-		ret = vfs_link_path(path, KIND_DIRECTORY);
+		ret = vfs_link_path(path, KIND_DIRECTORY, NULL);
 		if (ret != EOK) {
 			cli_error(CL_EFAIL, "%s: could not create %s (%s)",
Index: uspace/app/sysinst/futil.c
===================================================================
--- uspace/app/sysinst/futil.c	(revision ea4a3f0c5835f2731a1049dce68c43238d2ec20a)
+++ uspace/app/sysinst/futil.c	(revision a6fc88aa460096502eae43ccce7f29d4eed95e58)
@@ -128,5 +128,5 @@
 		} else if (s.is_directory) {
 			printf("Create directory '%s'\n", destp);
-			rc = vfs_link_path(destp, KIND_DIRECTORY);
+			rc = vfs_link_path(destp, KIND_DIRECTORY, NULL);
 			if (rc != EOK)
 				return EIO;
Index: uspace/app/sysinst/sysinst.c
===================================================================
--- uspace/app/sysinst/sysinst.c	(revision ea4a3f0c5835f2731a1049dce68c43238d2ec20a)
+++ uspace/app/sysinst/sysinst.c	(revision a6fc88aa460096502eae43ccce7f29d4eed95e58)
@@ -174,5 +174,5 @@
 		return EIO;
 
-	rc = vfs_link_path(MOUNT_POINT, KIND_DIRECTORY);
+	rc = vfs_link_path(MOUNT_POINT, KIND_DIRECTORY, NULL);
 	if (rc != EOK)
 		return rc;
@@ -213,5 +213,5 @@
 
 	printf("sysinst_copy_boot_files(): create CD mount point\n");
-	rc = vfs_link_path(CD_MOUNT_POINT, KIND_DIRECTORY);
+	rc = vfs_link_path(CD_MOUNT_POINT, KIND_DIRECTORY, NULL);
 	if (rc != EOK)
 		return rc;
Index: uspace/app/tester/vfs/vfs1.c
===================================================================
--- uspace/app/tester/vfs/vfs1.c	(revision ea4a3f0c5835f2731a1049dce68c43238d2ec20a)
+++ uspace/app/tester/vfs/vfs1.c	(revision a6fc88aa460096502eae43ccce7f29d4eed95e58)
@@ -71,5 +71,5 @@
 	int rc;
 
-	rc = vfs_link_path(TEST_DIRECTORY, KIND_DIRECTORY);
+	rc = vfs_link_path(TEST_DIRECTORY, KIND_DIRECTORY, NULL);
 	if (rc != EOK) {
 		TPRINTF("rc=%d\n", rc);
Index: uspace/app/untar/main.c
===================================================================
--- uspace/app/untar/main.c	(revision ea4a3f0c5835f2731a1049dce68c43238d2ec20a)
+++ uspace/app/untar/main.c	(revision a6fc88aa460096502eae43ccce7f29d4eed95e58)
@@ -105,5 +105,5 @@
 	int rc;
 
-	rc = vfs_link_path(header->filename, KIND_DIRECTORY);
+	rc = vfs_link_path(header->filename, KIND_DIRECTORY, NULL);
 	if (rc != EOK) {
 		if (rc != EEXIST) {
Index: uspace/lib/c/generic/vfs/vfs.c
===================================================================
--- uspace/lib/c/generic/vfs/vfs.c	(revision ea4a3f0c5835f2731a1049dce68c43238d2ec20a)
+++ uspace/lib/c/generic/vfs/vfs.c	(revision a6fc88aa460096502eae43ccce7f29d4eed95e58)
@@ -359,7 +359,9 @@
  * @param kind          Kind of the object to be created: KIND_FILE or
  *                      KIND_DIRECTORY
+ * @param[out] linkedfd If not NULL, will receive a file handle to the linked
+ *                      child
  * @return              EOK on success or a negative error code
  */
-int vfs_link(int parent, const char *child, vfs_file_kind_t kind)
+int vfs_link(int parent, const char *child, vfs_file_kind_t kind, int *linkedfd)
 {
 	int flags = (kind == KIND_DIRECTORY) ? WALK_DIRECTORY : WALK_REGULAR;
@@ -369,5 +371,8 @@
 		return file;
 
-	vfs_put(file);
+	if (linkedfd)
+		*linkedfd = file;
+	else
+		vfs_put(file);
 
 	return EOK;
@@ -384,7 +389,9 @@
  * @param kind          Kind of the object to be created: KIND_FILE or
  *                      KIND_DIRECTORY
+ * @param[out] linkedfd If not NULL, will receive a file handle to the linked
+ *                      child
  * @return              EOK on success or a negative error code
  */
-int vfs_link_path(const char *path, vfs_file_kind_t kind)
+int vfs_link_path(const char *path, vfs_file_kind_t kind, int *linkedfd)
 {
 	char *child;
@@ -393,5 +400,5 @@
 		return parent;
 
-	int rc = vfs_link(parent, child, kind);
+	int rc = vfs_link(parent, child, kind, linkedfd);
 
 	free(child);
Index: uspace/lib/c/include/vfs/vfs.h
===================================================================
--- uspace/lib/c/include/vfs/vfs.h	(revision ea4a3f0c5835f2731a1049dce68c43238d2ec20a)
+++ uspace/lib/c/include/vfs/vfs.h	(revision a6fc88aa460096502eae43ccce7f29d4eed95e58)
@@ -81,6 +81,6 @@
 extern async_exch_t *vfs_exchange_begin(void);
 extern void vfs_exchange_end(async_exch_t *);
-extern int vfs_link(int, const char *, vfs_file_kind_t);
-extern int vfs_link_path(const char *, vfs_file_kind_t);
+extern int vfs_link(int, const char *, vfs_file_kind_t, int *);
+extern int vfs_link_path(const char *, vfs_file_kind_t, int *);
 extern int vfs_lookup(const char *, int);
 extern int vfs_lookup_open(const char *, int, int);
Index: uspace/lib/posix/source/sys/stat.c
===================================================================
--- uspace/lib/posix/source/sys/stat.c	(revision ea4a3f0c5835f2731a1049dce68c43238d2ec20a)
+++ uspace/lib/posix/source/sys/stat.c	(revision a6fc88aa460096502eae43ccce7f29d4eed95e58)
@@ -152,5 +152,5 @@
 int posix_mkdir(const char *path, mode_t mode)
 {
-	int rc = rcerrno(vfs_link_path, path, KIND_DIRECTORY);
+	int rc = rcerrno(vfs_link_path, path, KIND_DIRECTORY, NULL);
 	if (rc != EOK)
 		return -1;
