simplegrep: open file in binary mode ("rb")

Otherwise it hangs on binary files (platform MinGW).
This commit is contained in:
Boris Nagaev 2016-06-04 02:29:26 +03:00 committed by Matthew Barr
parent e9cfbae68f
commit 373a624bad

View File

@ -77,7 +77,7 @@ static int eventHandler(unsigned int id, unsigned long long from,
* length with its length. Returns NULL on failure. * length with its length. Returns NULL on failure.
*/ */
static char *readInputData(const char *inputFN, unsigned int *length) { static char *readInputData(const char *inputFN, unsigned int *length) {
FILE *f = fopen(inputFN, "r"); FILE *f = fopen(inputFN, "rb");
if (!f) { if (!f) {
fprintf(stderr, "ERROR: unable to open file \"%s\": %s\n", inputFN, fprintf(stderr, "ERROR: unable to open file \"%s\": %s\n", inputFN,
strerror(errno)); strerror(errno));