X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Fmount_image.c;h=1a8443e3f6d6c36533af7c0b91f23afa49ca16b4;hb=bbce7c1d2333071b7056b65ba75074c639a027eb;hp=02a863c9b6ac55b47e09e01080bad6f085eaaefc;hpb=1fc939b7bd0b37900d974b1cd5b11df128df71f5;p=wimlib diff --git a/src/mount_image.c b/src/mount_image.c index 02a863c9..1a8443e3 100644 --- a/src/mount_image.c +++ b/src/mount_image.c @@ -1304,25 +1304,19 @@ msg_unmount_finished_handler(const void *_msg, void *_handler_ctx) static int unmount_timed_out_cb(void *_handler_ctx) { - struct unmount_msg_handler_context *handler_ctx = _handler_ctx; + const struct unmount_msg_handler_context *handler_ctx = _handler_ctx; - if (handler_ctx->daemon_pid == 0) { - goto out_crashed; - } else { - kill(handler_ctx->daemon_pid, 0); - if (errno == ESRCH) { - goto out_crashed; - } else { - DEBUG("Filesystem daemon is still alive... " - "Waiting another %d seconds\n", - handler_ctx->hdr.timeout_seconds); - return 0; - } + if (handler_ctx->daemon_pid == 0 || + (kill(handler_ctx->daemon_pid, 0) != 0 && errno == ESRCH)) + { + ERROR("The filesystem daemon has crashed! Changes to the " + "WIM may not have been commited."); + return WIMLIB_ERR_FILESYSTEM_DAEMON_CRASHED; } -out_crashed: - ERROR("The filesystem daemon has crashed! Changes to the " - "WIM may not have been commited."); - return WIMLIB_ERR_FILESYSTEM_DAEMON_CRASHED; + + DEBUG("Filesystem daemon is still alive... " + "Waiting another %d seconds", handler_ctx->hdr.timeout_seconds); + return 0; } static int @@ -1532,10 +1526,12 @@ execute_fusermount(const char *dir, bool lazy) "terminate"); return WIMLIB_ERR_FUSERMOUNT; } - if (status != 0) { + + if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) { ERROR("`umount' did not successfully complete"); return WIMLIB_ERR_FUSERMOUNT; } + return 0; } @@ -2035,7 +2031,7 @@ wimfs_readlink(const char *path, char *buf, size_t buf_len) if (!inode_is_symlink(inode)) return -EINVAL; if (buf_len == 0) - return -ENAMETOOLONG; + return -EINVAL; ret = wim_inode_readlink(inode, buf, buf_len - 1, NULL); if (ret >= 0) { wimlib_assert(ret <= buf_len - 1);