diff --git a/gpt.c b/gpt.c index c5f534f..59fafd6 100644 --- a/gpt.c +++ b/gpt.c @@ -362,6 +362,12 @@ int gpt_write(const struct gpt *gpt) return -1; } + rc = ioctl(fd, BLKRRPART); + if (rc != 0) { + fprintf(stderr, "failed to re-read partition table\n"); + return -1; + } + memcpy(&hdr, &gpt->header, sizeof(hdr)); hdr.ptbl_crc = 0; @@ -430,6 +436,12 @@ int gpt_write(const struct gpt *gpt) } } + rc = ioctl(fd, BLKRRPART); + if (rc != 0) { + fprintf(stderr, "failed to re-read partition table\n"); + return -1; + } + close(fd); return 0;