summaryrefslogtreecommitdiff
path: root/src/switchroot/ostree-remount.c
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2023-05-03 08:24:21 -0400
committerGitHub <noreply@github.com>2023-05-03 08:24:21 -0400
commit8a2993a9d01cc358e4c2d936ca132174aabdc714 (patch)
tree5402001ab710dadfd51ba3e9071b044016030e3e /src/switchroot/ostree-remount.c
parentdd70c9b78cc34ccc7e638eda4c2df1ddd8ee3add (diff)
parentc1044a02b28982ef6dd58af98b23a40482d26487 (diff)
downloadostree-8a2993a9d01cc358e4c2d936ca132174aabdc714.tar.gz
Merge pull request #2565 from cgwalters/clang-format
Add .clang-format file + tree-wide: Run `clang-format`
Diffstat (limited to 'src/switchroot/ostree-remount.c')
-rw-r--r--src/switchroot/ostree-remount.c42
1 files changed, 20 insertions, 22 deletions
diff --git a/src/switchroot/ostree-remount.c b/src/switchroot/ostree-remount.c
index a81c1b41..ba5a16b2 100644
--- a/src/switchroot/ostree-remount.c
+++ b/src/switchroot/ostree-remount.c
@@ -21,29 +21,28 @@
#include "config.h"
-#include <string.h>
-#include <stdio.h>
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
-#include <sys/param.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#include <sys/mount.h>
+#include <sys/param.h>
+#include <sys/stat.h>
#include <sys/statvfs.h>
-#include <fcntl.h>
-#include <stdlib.h>
#include <unistd.h>
-#include <sys/stat.h>
-#include <err.h>
-#include <errno.h>
#include <glib.h>
-#include "ostree-mount-util.h"
#include "glnx-backport-autocleanups.h"
+#include "ostree-mount-util.h"
static void
-do_remount (const char *target,
- bool writable)
+do_remount (const char *target, bool writable)
{
struct stat stbuf;
if (lstat (target, &stbuf) < 0)
@@ -80,7 +79,7 @@ do_remount (const char *target,
}
int
-main(int argc, char *argv[])
+main (int argc, char *argv[])
{
/* When systemd is in use this is normally created via the generator, but
* we ensure it's created here as well for redundancy.
@@ -115,16 +114,15 @@ main(int argc, char *argv[])
if (sysroot_configured_readonly)
do_remount ("/etc", true);
- /* If /var was created as as an OSTree default bind mount (instead of being a separate filesystem)
- * then remounting the root mount read-only also remounted it.
- * So just like /etc, we need to make it read-write by default.
- * If it was a separate filesystem, we expect it to be writable anyways,
- * so it doesn't hurt to remount it if so.
- *
- * And if we started out with a writable system root, then we need
- * to ensure that the /var bind mount created by the systemd generator
- * is writable too.
- */
+ /* If /var was created as as an OSTree default bind mount (instead of being a separate
+ * filesystem) then remounting the root mount read-only also remounted it. So just like /etc, we
+ * need to make it read-write by default. If it was a separate filesystem, we expect it to be
+ * writable anyways, so it doesn't hurt to remount it if so.
+ *
+ * And if we started out with a writable system root, then we need
+ * to ensure that the /var bind mount created by the systemd generator
+ * is writable too.
+ */
do_remount ("/var", true);
exit (EXIT_SUCCESS);