summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2006-07-26 13:32:44 +0000
committerMarcel Holtmann <marcel@holtmann.org>2006-07-26 13:32:44 +0000
commitb102348e988e4abc5d579ce13c067ce2c885aaf7 (patch)
treef7df67ce818aa8720f956171765889684c528ee1 /tools
parentabaf87668c896d8cebcfa1081eec195cd0008740 (diff)
Fix declared with attribute warn_unused_result errors
Diffstat (limited to 'tools')
-rw-r--r--tools/csr_bcsp.c3
-rw-r--r--tools/dfutool.c14
2 files changed, 12 insertions, 5 deletions
diff --git a/tools/csr_bcsp.c b/tools/csr_bcsp.c
index 77766114..29a60bf9 100644
--- a/tools/csr_bcsp.c
+++ b/tools/csr_bcsp.c
@@ -136,7 +136,8 @@ int csr_open_bcsp(char *device)
void put_uart(uint8_t ch)
{
- write(fd, &ch, 1);
+ if (write(fd, &ch, 1) < 0)
+ fprintf(stderr, "UART write error\n");
}
uint8_t get_uart(uint8_t *ch)
diff --git a/tools/dfutool.c b/tools/dfutool.c
index 8d5e9194..6bf65639 100644
--- a/tools/dfutool.c
+++ b/tools/dfutool.c
@@ -166,7 +166,8 @@ static struct usb_dev_handle *open_device(char *device, struct dfu_suffix *suffi
printf("\rSelect device (abort with 0): ");
fflush(stdout);
memset(str, 0, sizeof(str));
- fgets(str, sizeof(str) - 1, stdin);
+ if (!fgets(str, sizeof(str) - 1, stdin))
+ continue;
sel = atoi(str);
} while (!isdigit(str[0]) || sel < 0 || sel > num );
@@ -666,8 +667,12 @@ static void cmd_archive(char *device, int argc, char **argv)
for (i = 0; i < len; i++)
crc = crc32_byte(crc, buf[i]);
- if (len > 0)
- write(fd, buf, len);
+ if (len > 0) {
+ if (write(fd, buf, len) < 0) {
+ printf("\rCan't write next block: %s (%d)\n", strerror(errno), errno);
+ goto done;
+ }
+ }
n++;
if (len != 1023)
@@ -687,7 +692,8 @@ static void cmd_archive(char *device, int argc, char **argv)
suffix.dwCRC = cpu_to_le32(crc);
- write(fd, &suffix, DFU_SUFFIX_SIZE);
+ if (write(fd, &suffix, DFU_SUFFIX_SIZE) < 0)
+ printf("Can't write suffix block: %s (%d)\n", strerror(errno), errno);
done:
close(fd);