From: Eric Biggers Date: Tue, 22 May 2012 22:26:34 +0000 (-0500) Subject: Call delete_staging_dir() only on read-write mount X-Git-Tag: v0.7.2~1 X-Git-Url: https://wimlib.net/git/?p=wimlib;a=commitdiff_plain;h=46987f6ff2d27b0224f0ccab1b1e91164cae1d86 Call delete_staging_dir() only on read-write mount --- diff --git a/src/mount.c b/src/mount.c index 7f0def11..bd02cec6 100644 --- a/src/mount.c +++ b/src/mount.c @@ -427,22 +427,23 @@ static void wimfs_destroy(void *p) DEBUG("Received message: [%d %d]\n", msg[0], msg[1]); } - if (commit && (mount_flags & WIMLIB_MOUNT_FLAG_READWRITE)) { - status = chdir(working_directory); - if (status != 0) { - ERROR("chdir(): %m\n"); - status = WIMLIB_ERR_NOTDIR; - goto done; + status = 0; + if (mount_flags & WIMLIB_MOUNT_FLAG_READWRITE) { + if (commit) { + status = chdir(working_directory); + if (status != 0) { + ERROR("chdir(): %m\n"); + status = WIMLIB_ERR_NOTDIR; + goto done; + } + status = rebuild_wim(w, (check_integrity != 0)); + } + ret = delete_staging_dir(); + if (ret != 0) { + ERROR("Failed to delete the staging directory: %m\n"); + if (status == 0) + status = ret; } - status = rebuild_wim(w, (check_integrity != 0)); - } else { - status = 0; - } - ret = delete_staging_dir(); - if (ret != 0) { - ERROR("Failed to delete the staging directory: %m\n"); - if (status == 0) - status = ret; } done: ret = mq_send(daemon_to_unmount_mq, &status, 1, 1);