Index: uspace/lib/c/generic/elf/elf_mod.c
===================================================================
--- uspace/lib/c/generic/elf/elf_mod.c	(revision c1694b6b243b360b5f1fbf0629b5e7d4f7f4a515)
+++ uspace/lib/c/generic/elf/elf_mod.c	(revision 9246016f2cd9a449613c5c8a7e45dcdc5c78a8f5)
@@ -97,6 +97,9 @@
 	elf_ld_t elf;
 
-	int ofile = vfs_clone(file, -1, true);
-	int rc = vfs_open(ofile, MODE_READ);
+	int ofile;
+	int rc = vfs_clone(file, -1, true, &ofile);
+	if (rc == EOK) {
+		rc = vfs_open(ofile, MODE_READ);
+	}
 	if (rc != EOK) {
 		return rc;
@@ -116,7 +119,10 @@
     elf_finfo_t *info)
 {
-	int file = vfs_lookup(path, 0);
-	int rc = elf_load_file(file, so_bias, flags, info);
-	vfs_put(file);
+	int file;
+	int rc = vfs_lookup(path, 0, &file);
+	if (rc == EOK) {
+		rc = elf_load_file(file, so_bias, flags, info);
+		vfs_put(file);
+	}
 	return rc;
 }
