Delete staging directory on non-commit unmounts
authorEric Biggers <ebiggers3@gmail.com>
Sun, 20 May 2012 16:23:56 +0000 (11:23 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Sun, 20 May 2012 16:23:56 +0000 (11:23 -0500)
src/mount.c

index 844bb34d36c5bec0e1b9b43e9e837fb87aac9e63..7f0def11e27f37ec338bc0272c3c03b015ff5509 100644 (file)
@@ -374,9 +374,6 @@ static int rebuild_wim(WIMStruct *w, bool check_integrity)
                ERROR("Failed to commit changes\n");
                return ret;
        }
-       ret = delete_staging_dir();
-       if (ret != 0)
-               ERROR("Failed to delete the staging directory: %m\n");
        return ret;
 }
 
@@ -441,11 +438,16 @@ static void wimfs_destroy(void *p)
        } 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);
-       if (ret == -1) {
+       if (ret == -1)
                ERROR("Failed to send status to unmount process: %m\n");
-       }
        close_message_queues();
 }