Skip to content
This repository has been archived by the owner on Dec 21, 2021. It is now read-only.

Commit

Permalink
Fixing bug introduced due to Windows read() misbehavior
Browse files Browse the repository at this point in the history
  • Loading branch information
Gregungory committed Apr 27, 2016
1 parent 548ff00 commit 23c6cf8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/common/wordfile.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef lint
static const char RCSid[] = "$Id: wordfile.c,v 2.19 2016/03/23 18:17:46 greg Exp $";
static const char RCSid[] = "$Id: wordfile.c,v 2.20 2016/04/27 17:26:45 greg Exp $";
#endif
/*
* Load whitespace separated words from a file into an array.
Expand Down Expand Up @@ -41,7 +41,7 @@ wordfile( /* get words from fname, put in words */
words[0] = NULL;
while (nargs > 1 && (n += read(fd, buf+n, MAXWLEN-n)) > 0) {
int crem = 0;
if (n >= MAXWLEN) /* still something left? */
if (n > MAXWLEN/2) /* check for mid-word end */
while (!isspace(buf[--n])) {
if (n <= 0) /* one long word! */
goto done;
Expand Down

0 comments on commit 23c6cf8

Please sign in to comment.