diff options
author | H. Peter Anvin <hpa@zytor.com> | 2010-01-22 14:44:53 -0800 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2010-01-22 14:44:53 -0800 |
commit | 5396e250a679c368b3dd353c730358d6c54960c8 (patch) | |
tree | 5258e7f8b711da64773b2ec72a5f8631b7f32d81 /extlinux/main.c | |
parent | 2f6f568b25d57b8a60c2ab9132d67826111f39c0 (diff) | |
download | syslinux-5396e250a679c368b3dd353c730358d6c54960c8.tar.gz |
extlinux: make installer rewrite the whole file
With the additional patchable areas outside the main patch area, it is
now much more complicated to keep track of a high water mark of what
needs to be modified. It's easier to just rewrite the whole thing.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'extlinux/main.c')
-rw-r--r-- | extlinux/main.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/extlinux/main.c b/extlinux/main.c index b02cfe2d..2cfb1ea6 100644 --- a/extlinux/main.c +++ b/extlinux/main.c @@ -490,27 +490,30 @@ int patch_file_and_bootblock(int fd, const char *dir, int devfd) } strncpy((char *)boot_image + diroffset, subpath, dirlen); free(dirpath); + /* write subvol info if we have */ - if (*subvol) { - subvoloffset = get_16(&patcharea->subvoloffset); - subvollen = get_16(&patcharea->subvollen); - if (subvollen <= strlen(subvol)) { + subvoloffset = get_16(&patcharea->subvoloffset); + subvollen = get_16(&patcharea->subvollen); + if (subvollen <= strlen(subvol)) { fprintf(stderr, "Subvol name too long... aborting install!\n"); exit(1); - } - strncpy((char *)boot_image + subvoloffset, subvol, subvollen); } + strncpy((char *)boot_image + subvoloffset, subvol, subvollen); /* Now produce a checksum */ set_32(&patcharea->checksum, 0); - + csum = LDLINUX_MAGIC; for (i = 0, wp = (uint32_t *) boot_image; i < dw; i++, wp++) csum -= get_32(wp); /* Negative checksum */ set_32(&patcharea->checksum, csum); - return secptroffset + nptrs*4; + /* + * Assume all bytes modified. This can be optimized at the expense + * of keeping track of what the highest modified address ever was. + */ + return dw << 2; } /* |