Fixing off_t handling in flashcp

Paul Barker paul at paulbarker.me.uk
Sat Sep 26 03:55:07 PDT 2015


Hi,

flashcp uses "%lu" to print values of type off_t. For example, from line 307 of
flashcp.c, with formatting butchered to fit in 80 cols:

    log_printf (LOG_NORMAL,"\rWriting data: %dk/%luk (%lu%%)",
                KB (written + i),
                KB (filestat.st_size),
                PERCENTAGE (written + i,filestat.st_size));

The KB() macro doesn't change the type of filestat.st_size, which is 64 bits
when large file support is enabled. On a 32-bit system this should be printed as
"%llu" not "%lu".

Looking through the archives there is already a patch to address this but it
doesn't seem to have been applied or replied to:
http://lists.infradead.org/pipermail/linux-mtd/2014-November/056410.html

I'd like to see this fixed as the current display output is ugly on our systems.
Could someone take another look at this patch from Fabien? I'll also test this
at work this week to ensure it works correctly.

Thanks,

-- 
Paul Barker

Email: paul at paulbarker.me.uk
http://www.paulbarker.me.uk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-mtd/attachments/20150926/aaf0212e/attachment.sig>


More information about the linux-mtd mailing list