summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPali Rohár <pali.rohar@gmail.com>2013-04-07 14:39:26 +0200
committerPali Rohár <pali.rohar@gmail.com>2013-04-07 14:39:26 +0200
commita1febdd2ea6cd48d3c1eec54bbcd302a5efd0550 (patch)
tree851f384d47d9077a727d55d58cea159cca362327 /src
parent848e3fe06c3cddef5e527067c89e135ae630ee0c (diff)
download0xFFFF-a1febdd2ea6cd48d3c1eec54bbcd302a5efd0550.tar.bz2
local: Fix compile warning: declared with attribute warn_unused_result
Diffstat (limited to 'src')
-rw-r--r--src/local.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/local.c b/src/local.c
index 710b7f1..0b66939 100644
--- a/src/local.c
+++ b/src/local.c
@@ -294,7 +294,8 @@ int local_dump_image(enum image_type image, const char * file) {
continue;
buf[0] = 0;
- read(fd, buf, sizeof(buf));
+ if ( read(fd, buf, sizeof(buf)) < 0 )
+ buf[0] = 0;
close(fd);
if ( strncmp(buf, "internal", strlen("internal")) != 0 )
@@ -413,7 +414,8 @@ int local_dump_image(enum image_type image, const char * file) {
unlink(file);
} else if ( nlen != len ) {
printf("Truncating file %s to %d bytes...\n", file, (int)nlen);
- ftruncate(fd, nlen);
+ if ( ftruncate(fd, nlen) < 0 )
+ ERROR_INFO("Cannot truncate file %s", file);
}
clean: