Am 20.11.2009 22:26, schrieb Peter Stuge:
Maybe you can use fdopen() to tur the fd into FILE * once size is
known?
When done, just fclose() is sufficient, close() is not needed (and
will fail, since fclose() on fdopen()ed fds will close()). Confused
yet? :)
Stefan reminded me on how cbfstool does it: fopen, fseek to the end,
ftell, fseek to the beginning. I don't want to use a relatively obscure
call like fdopen() when the aim is portability, but thanks for the idea.
Only leaves the free(..) call removal around.
Patrick
--
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot