sort: fix a bug when sorting unterminated lines
authorPádraig Brady <P@draigBrady.com>
Thu, 15 Jul 2010 11:06:04 +0000 (12:06 +0100)
committerPádraig Brady <P@draigBrady.com>
Thu, 15 Jul 2010 11:09:33 +0000 (12:09 +0100)
* src/sort.c (fillbuf): The previous commit incorrectly
terminated the buffer when the last line of input
didn't contain a terminating character.

src/sort.c

index 45cb78f..7d31878 100644 (file)
@@ -1743,7 +1743,7 @@ fillbuf (struct buffer *buf, FILE *fp, char const *file)
                   if (buf->buf == ptrlim)
                     return false;
                   if (ptrlim[-1] != eol)
-                    *ptrlim++ = '\0';
+                    *ptrlim++ = eol;
                 }
             }