diff options
author | David Phillips <dbphillipsnz@gmail.com> | 2016-05-16 21:24:23 +1200 |
---|---|---|
committer | David Phillips <dbphillipsnz@gmail.com> | 2016-05-16 21:24:23 +1200 |
commit | 1a25ab508743cfdefaedaa351620bb0d78f50f03 (patch) | |
tree | d77a4c07960a853bc0e7b7e95221422531faa16d | |
parent | 8c04734d052fcea040de269457051539a57bab18 (diff) | |
download | pgm-interlace-1a25ab508743cfdefaedaa351620bb0d78f50f03.tar.xz |
Detect when no token of allowable chars can be read
-rw-r--r-- | pgm-interlace.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/pgm-interlace.c b/pgm-interlace.c index fbc1cc8..eeaade4 100644 --- a/pgm-interlace.c +++ b/pgm-interlace.c @@ -136,6 +136,12 @@ int read_token(FILE *fd, char *token, size_t token_size, const char *allowable) token[t] = '\0'; + if (strlen(token) == 0) + { + fprintf(stderr, "read_token: no token available\n"); + return 1; + } + return 0; } |