1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-23 17:34:00 +03:00

growfs: don't actually resize on dry-run

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.

(cherry picked from commit d26c0f7243)
This commit is contained in:
undef 2022-07-14 05:53:15 +00:00 committed by Zbigniew Jędrzejewski-Szmek
parent e56bfc8a41
commit 00c6c62845

View 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); return log_error_errno(errno, "Failed to query size of \"%s\": %m", devpath);
log_debug("Resizing \"%s\" to %"PRIu64" bytes...", arg_target, size); log_debug("Resizing \"%s\" to %"PRIu64" bytes...", arg_target, size);
if (arg_dry_run)
return 0;
r = resize_fs(mountfd, size, &newsize); r = resize_fs(mountfd, size, &newsize);
if (r < 0) if (r < 0)
return log_error_errno(r, "Failed to resize \"%s\" to %"PRIu64" bytes: %m", return log_error_errno(r, "Failed to resize \"%s\" to %"PRIu64" bytes: %m",