1
0
Fork 0

Merging upstream version 4.3+20241108.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-14 06:11:53 +01:00
parent 1e24552bfc
commit 60ccb5b596
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
64 changed files with 2015 additions and 1768 deletions

View file

@ -40,6 +40,7 @@
#include "mdadm.h"
#include "part.h"
#include "xmalloc.h"
static void free_gpt(struct supertype *st)
{
@ -105,7 +106,8 @@ static int load_gpt(struct supertype *st, int fd, char *devname)
return 1;
}
/* Set offset to second block (GPT header) */
lseek(fd, sector_size, SEEK_SET);
if (lseek(fd, sector_size, SEEK_SET) == -1L)
goto no_read;
/* Seem to have GPT, load the header */
gpt_head = (struct GPT*)(super+1);
if (read(fd, gpt_head, sizeof(*gpt_head)) != sizeof(*gpt_head))
@ -118,7 +120,8 @@ static int load_gpt(struct supertype *st, int fd, char *devname)
to_read = __le32_to_cpu(gpt_head->part_cnt) * sizeof(struct GPT_part_entry);
to_read = ((to_read+511)/512) * 512;
/* Set offset to third block (GPT entries) */
lseek(fd, sector_size*2, SEEK_SET);
if (lseek(fd, sector_size * 2, SEEK_SET) == -1L)
goto no_read;
if (read(fd, gpt_head+1, to_read) != to_read)
goto no_read;