]> wimlib.net Git - wimlib/blobdiff - src/mount.c
Clean up file headers
[wimlib] / src / mount.c
index 844bb34d36c5bec0e1b9b43e9e837fb87aac9e63..10e5d7de1b2c8deb420343b4342fa1224cc9341f 100644 (file)
@@ -5,28 +5,31 @@
  * Filesystem in Userspace.  FUSE allows a filesystem to be implemented in a
  * userspace process by implementing the filesystem primitives--- read(),
  * write(), readdir(), etc.
- *
+ */
+
+/*
  * Copyright (C) 2012 Eric Biggers
  *
- * wimlib - Library for working with WIM files 
+ * This file is part of wimlib, a library for working with WIM files.
  *
- * This library is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by the Free
- * Software Foundation; either version 2.1 of the License, or (at your option) any
- * later version.
+ * wimlib is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
  *
- * This library is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * wimlib is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
  *
- * You should have received a copy of the GNU Lesser General Public License along
- * with this library; if not, write to the Free Software Foundation, Inc., 59
- * Temple Place, Suite 330, Boston, MA 02111-1307 USA 
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with wimlib; if not, see http://www.gnu.org/licenses/.
  */
 
 #include "wimlib_internal.h"
 
 #ifdef WITH_FUSE
+#include "sha1.h"
 #include "lookup_table.h"
 #include "xml.h"
 #include <stdlib.h>
@@ -374,9 +377,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;
 }
 
@@ -430,22 +430,28 @@ 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;
        }
 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();
 }