In file.c::readfile() the file was being opened once at fd declaration
time and then again a few lines later and only being closed once. Remove
the open() at fd declaration time leaving the later one where the fd check
is done.
Signed-off-by: Andrew Clayton <andrew@digital-domain.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
static int readfile(const char *filename, struct memblock *mem)
{
- int ret, fd = open(filename, O_RDONLY);
+ int ret, fd;
struct stat st;
char *buf;