]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
growfs: don't actually resize on dry-run
authorundef <gitlab@undef.tools>
Thu, 14 Jul 2022 05:53:15 +0000 (05:53 +0000)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 14 Jul 2022 12:23:11 +0000 (21:23 +0900)
This causes systemd-growfs to exit before resizing the partition when
`--dry-run` is passed. Resizing during a dry run of a change breaks the
users expectations.

src/partition/growfs.c

index 31dcf0ffdf14f47c3f00bc85d816789e66994c32..d9603d2b6d185d950d31c6284e6574886e46fc70 100644 (file)
@@ -241,6 +241,10 @@ static int run(int argc, char *argv[]) {
                 return log_error_errno(errno, "Failed to query size of \"%s\": %m", devpath);
 
         log_debug("Resizing \"%s\" to %"PRIu64" bytes...", arg_target, size);
+
+        if (arg_dry_run)
+                return 0;
+
         r = resize_fs(mountfd, size, &newsize);
         if (r < 0)
                 return log_error_errno(r, "Failed to resize \"%s\" to %"PRIu64" bytes: %m",