From: scarlet-storm <12461256+scarlet-storm@users.noreply.github.com> Date: Fri, 27 Dec 2024 10:26:12 +0000 (+0530) Subject: homework: Remove zeroing of PMBR X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a24f11798b13e17d4f88dd1af2b962c98800da37;p=thirdparty%2Fsystemd.git homework: Remove zeroing of PMBR Remove zeroing of PMBR before writing out the new partition table. There is no reason, to do this explicitly ? --- diff --git a/src/home/homework-luks.c b/src/home/homework-luks.c index 7ae0f80985a..e559836cc4a 100644 --- a/src/home/homework-luks.c +++ b/src/home/homework-luks.c @@ -2856,9 +2856,7 @@ static int apply_resize_partition( size_t new_partition_size) { _cleanup_(fdisk_unref_contextp) struct fdisk_context *c = NULL; - _cleanup_free_ void *two_zero_lbas = NULL; uint32_t ssz; - ssize_t n; int r; assert(fd >= 0); @@ -2873,17 +2871,6 @@ static int apply_resize_partition( if (r < 0) return log_error_errno(r, "Failed to determine current sector size: %m"); - two_zero_lbas = malloc0(ssz * 2); - if (!two_zero_lbas) - return log_oom(); - - /* libfdisk appears to get confused by the existing PMBR. Let's explicitly flush it out. */ - n = pwrite(fd, two_zero_lbas, ssz * 2, 0); - if (n < 0) - return log_error_errno(errno, "Failed to wipe partition table: %m"); - if ((size_t) n != ssz * 2) - return log_error_errno(SYNTHETIC_ERRNO(EIO), "Short write while wiping partition table."); - r = fdisk_new_context_at(fd, /* path= */ NULL, /* read_only= */ false, ssz, &c); if (r < 0) return log_error_errno(r, "Failed to open device: %m");