From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Babic Date: Mon, 19 Aug 2013 13:17:04 +0200 Subject: [U-Boot] [PATCH v2 5/7] tools: add padding of data image file for imximage In-Reply-To: <201308130710.17878.marex@denx.de> References: <1373548001-19728-1-git-send-email-sbabic@denx.de> <1376318374-3497-1-git-send-email-sbabic@denx.de> <1376318374-3497-6-git-send-email-sbabic@denx.de> <201308130710.17878.marex@denx.de> Message-ID: <5211FEB0.5080509@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Marek, On 13/08/2013 07:10, Marek Vasut wrote: > Dear Stefano Babic, > >> Implement function vrec_header to be able to pad the final >> data image file according the what has been calculated for >> boot_data.length. >> >> Signed-off-by: Stefano Babic >> --- > > [...] > >> + if (!imxhdr) { >> + fprintf(stderr, "%s: malloc return failure: %s\n", >> + params->cmdname, strerror(errno)); >> + exit(EXIT_FAILURE); >> + } >> + >> + memset(imxhdr, 0, alloc_len); >> + >> + tparams->header_size = alloc_len; >> + tparams->hdr = imxhdr; >> + >> + /* determine data image file length */ > > Why dont you just call stat(2) here instead of the open+fstat+close combo? Thanks, replaced in V3. Best regards, Stefano Babic -- ===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================