diff options
-rw-r--r-- | usr.bin/diff/diffreg.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c index 2757ef06f53..86ab79e53df 100644 --- a/usr.bin/diff/diffreg.c +++ b/usr.bin/diff/diffreg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diffreg.c,v 1.62 2005/01/13 08:27:45 otto Exp $ */ +/* $OpenBSD: diffreg.c,v 1.63 2006/02/16 08:15:05 otto Exp $ */ /* * Copyright (C) Caldera International Inc. 2001-2002. @@ -65,7 +65,7 @@ */ #ifndef lint -static const char rcsid[] = "$OpenBSD: diffreg.c,v 1.62 2005/01/13 08:27:45 otto Exp $"; +static const char rcsid[] = "$OpenBSD: diffreg.c,v 1.63 2006/02/16 08:15:05 otto Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -977,6 +977,8 @@ preadline(int fd, size_t len, off_t off) line = emalloc(len + 1); if ((nr = pread(fd, line, len, off)) < 0) err(1, "preadline"); + if (nr > 0 && line[nr-1] == '\n') + nr--; line[nr] = '\0'; return (line); } |