diff options
author | Boris Brezillon <boris.brezillon@free-electrons.com> | 2016-11-25 18:30:41 +0100 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2016-12-06 19:38:16 +0100 |
commit | bfb33f2f46a40023aa9820f4cdd99281e41250c1 (patch) | |
tree | 148d0f16e4936218b4d3f89a2ee45d8c12bcfb6b /nand-utils/nftldump.c | |
parent | b2a9601cebb67db9e02ac7bbd927a21aa95f5ba3 (diff) |
common: Fix 'unchecked return code' warnings
Several tools are simply not checking return code of functions marked
with 'warn_unused_result'.
Provide wrappers for the read/write functions to avoid patching old
code and providing proper error handling.
Fix the remaining ones (calls to fgets() and system()).
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Diffstat (limited to 'nand-utils/nftldump.c')
-rw-r--r-- | nand-utils/nftldump.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/nand-utils/nftldump.c b/nand-utils/nftldump.c index 32f4f2f..30332fe 100644 --- a/nand-utils/nftldump.c +++ b/nand-utils/nftldump.c @@ -39,6 +39,8 @@ #include <mtd/nftl-user.h> #include <mtd_swab.h> +#include "common.h" + static struct NFTLMediaHeader MedHead[2]; static mtd_info_t meminfo; @@ -73,7 +75,7 @@ static unsigned int find_media_headers(void) NumMedHeads = 0; while (ofs < meminfo.size) { - pread(fd, &MedHead[NumMedHeads], sizeof(struct NFTLMediaHeader), ofs); + pread_nocheck(fd, &MedHead[NumMedHeads], sizeof(struct NFTLMediaHeader), ofs); if (!strncmp(MedHead[NumMedHeads].DataOrgID, "ANAND", 6)) { SWAP16(MedHead[NumMedHeads].NumEraseUnits); SWAP16(MedHead[NumMedHeads].FirstPhysicalEUN); @@ -93,7 +95,7 @@ static unsigned int find_media_headers(void) /* read BadUnitTable, I don't know why pread() does not work for larger (7680 bytes) chunks */ for (i = 0; i < MAX_ERASE_ZONES; i += 512) - pread(fd, &BadUnitTable[i], 512, ofs + 512 + i); + pread_nocheck(fd, &BadUnitTable[i], 512, ofs + 512 + i); } else printf("Second NFTL Media Header found at offset 0x%08lx\n",ofs); NumMedHeads++; @@ -233,10 +235,10 @@ static void dump_virtual_units(void) if (lastgoodEUN == 0xffff) memset(readbuf, 0, 512); else - pread(fd, readbuf, 512, + pread_nocheck(fd, readbuf, 512, (lastgoodEUN * ERASESIZE) + (j * 512)); - write(ofd, readbuf, 512); + write_nocheck(ofd, readbuf, 512); } } |