]> wimlib.net Git - wimlib/blobdiff - src/mount_image.c
Remove some dead assignments
[wimlib] / src / mount_image.c
index 1c31cae26792a7ff32469c06327f6efae77203b2..f8e733d872116cb3b0aa455d632f87e8320d4199 100644 (file)
@@ -31,6 +31,7 @@
 #endif
 
 #include "wimlib.h"
+#include "wimlib/error.h"
 
 #ifdef WITH_FUSE
 
@@ -378,16 +379,16 @@ wim_pathname_to_stream(const struct wimfs_context *ctx, const char *path,
        struct wim_dentry *dentry;
        struct wim_lookup_table_entry *lte;
        u16 stream_idx;
-       const tchar *stream_name = NULL;
+       const char *stream_name = NULL;
        struct wim_inode *inode;
-       tchar *p = NULL;
+       char *p = NULL;
 
        lookup_flags |= ctx->default_lookup_flags;
 
        if (lookup_flags & LOOKUP_FLAG_ADS_OK) {
                stream_name = path_stream_name(path);
                if (stream_name) {
-                       p = (tchar*)stream_name - 1;
+                       p = (char *)stream_name - 1;
                        *p = T('\0');
                }
        }
@@ -1189,8 +1190,10 @@ out:
        /* Leave the image mounted if commit failed, unless this is a
         * forced unmount.  The user can retry without commit if they
         * want.  */
-       if (!ret || (unmount_flags & WIMLIB_UNMOUNT_FLAG_FORCE))
+       if (!ret || (unmount_flags & WIMLIB_UNMOUNT_FLAG_FORCE)) {
+               unlock_wim_for_append(wimfs_ctx->wim);
                fuse_exit(fuse_ctx->fuse);
+       }
        if (mq != (mqd_t)-1)
                mq_close(mq);
        return ret;
@@ -2098,9 +2101,11 @@ wimlib_mount_image(WIMStruct *wim, int image, const char *dir,
                return WIMLIB_ERR_INVALID_PARAM;
        }
 
-       ret = lock_wim_for_append(wim, wim->in_fd.fd);
-       if (ret)
-               return ret;
+       if (mount_flags & WIMLIB_MOUNT_FLAG_READWRITE) {
+               ret = lock_wim_for_append(wim);
+               if (ret)
+                       return ret;
+       }
 
        /* If the user did not specify an interface for accessing named
         * data streams, use the default (extended attributes).  */
@@ -2255,7 +2260,7 @@ wimlib_mount_image(WIMStruct *wim, int image, const char *dir,
        if (mount_flags & WIMLIB_MOUNT_FLAG_READWRITE)
                delete_staging_dir(&ctx);
 out_unlock:
-       unlock_wim_for_append(wim, wim->in_fd.fd);
+       unlock_wim_for_append(wim);
        return ret;
 }
 
@@ -2411,7 +2416,8 @@ do_unmount_commit(const char *dir, int unmount_flags,
                ret = do_unmount(dir);
        if (progfunc) {
                /* Terminate the progress thread.  */
-               mq_send(mq, NULL, 0, 1);
+               char empty[0];
+               mq_send(mq, empty, 0, 1);
                pthread_join(commit_progress_tid, NULL);
        }
 out_delete_mq: