]> wimlib.net Git - wimlib/blobdiff - src/mount.c
wimlib_select_image() => select_wim_image()
[wimlib] / src / mount.c
index abc7fb938df074395860795554fa99bb203acee2..f2dad8d3714d945726d4e9c35f4d767cdfa06a4e 100644 (file)
@@ -1267,14 +1267,14 @@ static int wimfs_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
 
 static int wimfs_readlink(const char *path, char *buf, size_t buf_len)
 {
-       struct dentry *dentry = get_dentry(w, path);
+       struct inode *inode = wim_pathname_to_inode(w, path);
        int ret;
-       if (!dentry)
+       if (!inode)
                return -ENOENT;
-       if (!dentry_is_symlink(dentry))
+       if (!inode_is_symlink(inode))
                return -EINVAL;
 
-       ret = inode_readlink(dentry->d_inode, buf, buf_len, w);
+       ret = inode_readlink(inode, buf, buf_len, w);
        if (ret > 0)
                ret = 0;
        return ret;
@@ -1729,7 +1729,7 @@ WIMLIBAPI int wimlib_mount(WIMStruct *wim, int image, const char *dir,
                wim->lookup_table = joined_tab;
        }
 
-       ret = wimlib_select_image(wim, image);
+       ret = select_wim_image(wim, image);
 
        if (ret != 0)
                goto out;
@@ -1738,6 +1738,12 @@ WIMLIBAPI int wimlib_mount(WIMStruct *wim, int image, const char *dir,
 
        DEBUG("Selected image %d", image);
 
+       if (imd->root_dentry->refcnt != 1) {
+               ERROR("Cannot mount image that was just exported with "
+                     "wimlib_export()");
+               return WIMLIB_ERR_INVALID_PARAM;
+       }
+
        next_ino = assign_inode_numbers(&imd->inode_list);
 
        DEBUG("(next_ino = %"PRIu64")", next_ino);