The branch, master has been updated
via 701c887bf37084b271eb1df392e2aa9f33452dd7 (commit)
from a286b033af1388f690e7e23ab02451e7aa58e2b4 (commit)
- Log -----------------------------------------------------------------
commit 701c887bf37084b271eb1df392e2aa9f33452dd7
Author: Thilo Schulz <thilo@xxxxxxx>
Date: Sat Oct 10 13:06:04 2015 +0200
Fix segfault crash if output file cannot be opened
-----------------------------------------------------------------------
Summary of changes:
ftdi_eeprom/main.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/ftdi_eeprom/main.c b/ftdi_eeprom/main.c
index edcfad7..0d75c24 100644
--- a/ftdi_eeprom/main.c
+++ b/ftdi_eeprom/main.c
@@ -35,6 +35,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <errno.h>
#include <confuse.h>
#include <libusb.h>
@@ -395,10 +396,15 @@ int main(int argc, char *argv[])
}
if (filename != NULL && strlen(filename) > 0)
{
-
FILE *fp = fopen (filename, "wb");
- fwrite (eeprom_buf, 1, my_eeprom_size, fp);
- fclose (fp);
+
+ if(fp)
+ {
+ fwrite(eeprom_buf, 1, my_eeprom_size, fp);
+ fclose(fp);
+ }
+ else
+ fprintf(stderr, "Could not open output file %s: %s\n",
filename, strerror(errno));
}
else
{
hooks/post-receive
--
A library to talk to FTDI chips
--
libftdi-git - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi-git+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx
|