diff options
Diffstat (limited to 'sysutils/mtools/patches/patch-af')
-rw-r--r-- | sysutils/mtools/patches/patch-af | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/sysutils/mtools/patches/patch-af b/sysutils/mtools/patches/patch-af new file mode 100644 index 00000000000..563ca9ecf05 --- /dev/null +++ b/sysutils/mtools/patches/patch-af @@ -0,0 +1,40 @@ +$NetBSD: patch-af,v 1.1 2000/12/07 14:11:37 is Exp $ + +--- init.c.orig Fri Mar 19 09:57:59 1999 ++++ init.c +@@ -27,15 +27,30 @@ + */ + static int read_boot(Stream_t *Stream, struct bootsector * boot, int size) + { ++ int rc; ++ char *buf; ++ ++ buf = (char *)boot; ++ + /* read the first sector, or part of it */ + if(!size) + size = BOOTSIZE; +- if(size > 1024) +- size = 1024; + +- if (force_read(Stream, (char *) boot, 0, size) != size) +- return -1; +- return 0; ++ if (size > sizeof(struct bootsector)) { ++ buf = malloc(size); ++ if (!buf) ++ return(-1); ++ } ++ ++ rc = 0; ++ if (force_read(Stream, buf, 0, size) != size) ++ rc = -1; ++ ++ if (buf != (char *)boot) { ++ memcpy(boot, buf, sizeof(struct bootsector)); ++ free(buf); ++ } ++ return rc; + } + + static int fs_flush(Stream_t *Stream) |