diff options
| author | Marcel Holtmann <marcel@holtmann.org> | 2006-07-26 13:32:44 +0000 | 
|---|---|---|
| committer | Marcel Holtmann <marcel@holtmann.org> | 2006-07-26 13:32:44 +0000 | 
| commit | b102348e988e4abc5d579ce13c067ce2c885aaf7 (patch) | |
| tree | f7df67ce818aa8720f956171765889684c528ee1 /tools/dfutool.c | |
| parent | abaf87668c896d8cebcfa1081eec195cd0008740 (diff) | |
Fix declared with attribute warn_unused_result errors
Diffstat (limited to 'tools/dfutool.c')
| -rw-r--r-- | tools/dfutool.c | 14 | 
1 files changed, 10 insertions, 4 deletions
| 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); | 
