summaryrefslogtreecommitdiffstats
path: root/uisimulator
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2012-02-19 14:42:11 +0100
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2012-02-19 14:42:11 +0100
commit37dff886f4d7b4513bc2772b33455caf2a375065 (patch)
treeefcc833395b23e7345606414b7d4c8b09063ce55 /uisimulator
parent2dbb17d0d6230194b3373c9e61bb70cacd29a972 (diff)
downloadrockbox-37dff886f4d7b4513bc2772b33455caf2a375065.tar.gz
rockbox-37dff886f4d7b4513bc2772b33455caf2a375065.zip
Fix warn_unused_result warning.
A warning triggered by attribute warn_unused_result cannot be suppressed by casting the result to void. Properly check the return value and pass it to the caller. Fix the check for the number of bytes written. The return value of fread is the number of items written, not the number of bytes. Change-Id: I8c60e23ac549e22fd3f7dd5c51c5a8e6fc517cb1
Diffstat (limited to 'uisimulator')
-rw-r--r--uisimulator/common/stubs.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/uisimulator/common/stubs.c b/uisimulator/common/stubs.c
index a8ee5fb5ff..2a81587d83 100644
--- a/uisimulator/common/stubs.c
+++ b/uisimulator/common/stubs.c
@@ -188,9 +188,15 @@ int storage_write_sectors(IF_MV2(int drive,)
sprintf(name,"sector%lX.bin",start+i);
f=fopen(name,"wb");
if (f) {
- (void)fwrite(buf,512,1,f);
+ if(fwrite(buf,512,1,f) != 1) {
+ fclose(f);
+ return -1;
+ }
fclose(f);
}
+ else {
+ return -1;
+ }
}
return 0;
}
@@ -214,7 +220,7 @@ int storage_read_sectors(IF_MV2(int drive,)
if (f) {
ret = fread(buf,512,1,f);
fclose(f);
- if (ret != 512)
+ if (ret != 1)
return -1;
}
}