/* 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;
/* 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);
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
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;
goto out_free_message_queue_names;
argc = 0;
- argv[argc++] = IMAGEX_PROGNAME;
+ argv[argc++] = "wimlib";
argv[argc++] = dir_copy;
/* disable multi-threaded operation */