]> wimlib.net Git - wimlib/blobdiff - src/mount_image.c
Win32 capture: Readdir and query short name with native API
[wimlib] / src / mount_image.c
index 2f9f440efb86eab662780cca5d16fb2b39e9d582..12b193e3ad1081f6ba2f73bfbd9f12e8b1004361 100644 (file)
@@ -116,9 +116,9 @@ struct wimfs_context {
        /* Name and message queue descriptors for message queues between the
         * filesystem daemon process and the unmount process.  These are used
         * when the filesystem is unmounted and the process running
-        * wimlib_unmount_image() (i.e. the `imagex unmount' command) needs to
-        * communicate with the filesystem daemon running fuse_main() (i.e. the
-        * daemon created by the `imagex mount' or `imagex mountrw' commands */
+        * wimlib_unmount_image() needs to communicate with the filesystem
+        * daemon running fuse_main() (i.e. the process created by a call to
+        * wimlib_mount_image().  */
        char *unmount_to_daemon_mq_name;
        char *daemon_to_unmount_mq_name;
        mqd_t unmount_to_daemon_mq;
@@ -567,7 +567,8 @@ extract_resource_to_staging_dir(struct wim_inode *inode,
 
        /* Extract the stream to the staging file (possibly truncated) */
        if (old_lte) {
-               struct filedes wimlib_fd = {.fd = fd};
+               struct filedes wimlib_fd;
+               filedes_init(&wimlib_fd, fd);
                extract_size = min(wim_resource_size(old_lte), size);
                ret = extract_wim_resource_to_fd(old_lte, &wimlib_fd,
                                                 extract_size);
@@ -1667,9 +1668,12 @@ wimfs_getxattr(const char *path, const char *name, char *value,
                return -ERANGE;
 
        ret = read_full_resource_into_buf(lte, value);
-       if (ret)
-               return -errno;
-
+       if (ret) {
+               if (errno)
+                       return -errno;
+               else
+                       return -EIO;
+       }
        return res_size;
 }
 #endif
@@ -2192,7 +2196,7 @@ wimfs_truncate(const char *path, off_t size)
        if (lte == NULL && size == 0)
                return 0;
 
-       if (lte->resource_location == RESOURCE_IN_STAGING_FILE) {
+       if (lte != NULL && lte->resource_location == RESOURCE_IN_STAGING_FILE) {
                ret = truncate(lte->staging_file_name, size);
                if (ret)
                        ret = -errno;
@@ -2478,7 +2482,7 @@ wimlib_mount_image(WIMStruct *wim, int image, const char *dir,
                goto out_free_message_queue_names;
 
        argc = 0;
-       argv[argc++] = IMAGEX_PROGNAME;
+       argv[argc++] = "wimlib";
        argv[argc++] = dir_copy;
 
        /* disable multi-threaded operation */