diff --git a/utils/meizu_dfu/Makefile b/utils/meizu_dfu/Makefile index 6b368fa21b..fdd765daa1 100644 --- a/utils/meizu_dfu/Makefile +++ b/utils/meizu_dfu/Makefile @@ -1,8 +1,9 @@ +CFLAGS = -W -Wall +LDFLAGS = -lusb all: meizu_dfu meizu_dfu: meizu_dfu.c - gcc -o meizu_dfu meizu_dfu.c -lusb .PHONY: clean clean: diff --git a/utils/meizu_dfu/meizu_dfu.c b/utils/meizu_dfu/meizu_dfu.c index 0e32ea8d35..1658c4d1e8 100644 --- a/utils/meizu_dfu/meizu_dfu.c +++ b/utils/meizu_dfu/meizu_dfu.c @@ -27,6 +27,7 @@ #include #include #include +#include #include @@ -110,7 +111,10 @@ void init_img(image_data_t *img, const char *filename, image_attr_t *attr) printf("Reading %s...", filename); - stat(filename, &statbuf); + if (stat(filename, &statbuf) < 0) { + printf("\nCould not stat file, exiting.\n"); + exit(1); + } len = statbuf.st_size; img->name = basename(strdup(filename));