X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=src%2Fmount_image.c;h=6c5ec885ceea017a4d306d6247083fbc280d71cd;hp=b9b63450868866832b3a24b5f10254c7057f12b4;hb=8eaff5673d8e133e72e20cf4409ab4c901831424;hpb=4016a9dba036f4d2eca0253c99370e6647a9ccb6 diff --git a/src/mount_image.c b/src/mount_image.c index b9b63450..6c5ec885 100644 --- a/src/mount_image.c +++ b/src/mount_image.c @@ -109,6 +109,9 @@ struct wimfs_context { uid_t default_uid; gid_t default_gid; + + int status; + bool have_status; }; static void init_wimfs_context(struct wimfs_context *ctx) @@ -1236,7 +1239,8 @@ out: status = ret; } } - send_unmount_finished_msg(wimfs_ctx->daemon_to_unmount_mq, status); + wimfs_ctx->status = status; + wimfs_ctx->have_status = true; return MSG_BREAK_LOOP; } @@ -1565,7 +1569,6 @@ static void wimfs_destroy(void *p) message_loop(wimfs_ctx->unmount_to_daemon_mq, &daemon_msg_handler_callbacks, &handler_ctx.hdr); - close_message_queues(wimfs_ctx); } } @@ -2530,14 +2533,23 @@ WIMLIBAPI int wimlib_mount_image(WIMStruct *wim, int image, const char *dir, DEBUG("Returned from fuse_main() (ret = %d)", ret); - if (ret) + if (ret) { ret = WIMLIB_ERR_FUSE; + } else { + if (ctx.have_status) + ret = ctx.status; + else + ret = WIMLIB_ERR_TIMEOUT; + } + if (ctx.daemon_to_unmount_mq != (mqd_t)(-1)) { + send_unmount_finished_msg(ctx.daemon_to_unmount_mq, ret); + close_message_queues(&ctx); + } /* Try to delete the staging directory if a deletion wasn't yet * attempted due to an earlier error */ if (ctx.staging_dir_name) delete_staging_dir(&ctx); - out_free_dir_copy: FREE(dir_copy); out_unlock: