X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=arch%2Fmips%2Fboot%2Faddinitrd.c;h=8b30333047707b012570875bcf0d3ea82e373d5e;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=38261f1ae2828ddde4da8b3362c45aa9539a638d;hpb=87fc8d1bb10cd459024a742c6a10961fefcef18f;p=linux-2.6.git diff --git a/arch/mips/boot/addinitrd.c b/arch/mips/boot/addinitrd.c index 38261f1ae..8b3033304 100644 --- a/arch/mips/boot/addinitrd.c +++ b/arch/mips/boot/addinitrd.c @@ -2,6 +2,8 @@ * addinitrd - program to add a initrd image to an ecoff kernel * * (C) 1999 Thomas Bogendoerfer + * minor modifications, cleanup: Guido Guenther + * further cleanup: Maciej W. Rozycki */ #include @@ -54,7 +56,7 @@ int main (int argc, char *argv[]) exit (1); } - if ((fd_vmlinux = open (argv[1],O_RDWR)) < 0) + if ((fd_vmlinux = open (argv[1],O_RDONLY)) < 0) die ("open vmlinux"); if (read (fd_vmlinux, &efile, sizeof efile) != sizeof efile) die ("read file header"); @@ -78,6 +80,11 @@ int main (int argc, char *argv[]) swab = 1; } + /* make sure we have an empty data segment for the initrd */ + if (eaout.dsize || esecs[1].s_size) { + fprintf (stderr, "Data segment not empty. Giving up!\n"); + exit (1); + } if ((fd_initrd = open (argv[2], O_RDONLY)) < 0) die ("open initrd"); if (fstat (fd_initrd, &st) < 0)