*/
/*
- * Copyright (C) 2012 Eric Biggers
+ * Copyright (C) 2012, 2013 Biggers
*
* This file is part of wimlib, a library for working with WIM files.
*
uid_t default_uid;
gid_t default_gid;
+
+ int status;
+ bool have_status;
};
static void init_wimfs_context(struct wimfs_context *ctx)
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;
}
message_loop(wimfs_ctx->unmount_to_daemon_mq,
&daemon_msg_handler_callbacks,
&handler_ctx.hdr);
- close_message_queues(wimfs_ctx);
}
}
if (existing_ads_entry) {
if (flags & XATTR_CREATE)
return -EEXIST;
- inode_remove_ads(inode, ads_idx, ctx->wim->lookup_table);
} else {
if (flags & XATTR_REPLACE)
return -ENOATTR;
ret = inode_add_ads_with_data(inode, name, (const u8*)value,
size, ctx->wim->lookup_table);
- return ret ? -ENOMEM : 0;
+ if (ret == 0) {
+ if (existing_ads_entry)
+ inode_remove_ads(inode, ads_idx, ctx->wim->lookup_table);
+ } else {
+ ret = -ENOMEM;
+ }
+ return ret;
}
#endif
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: