diff options
-rw-r--r-- | sys/miscfs/kernfs/kernfs_vnops.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/miscfs/kernfs/kernfs_vnops.c b/sys/miscfs/kernfs/kernfs_vnops.c index 3db0fadc84e..383bb5df40b 100644 --- a/sys/miscfs/kernfs/kernfs_vnops.c +++ b/sys/miscfs/kernfs/kernfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kernfs_vnops.c,v 1.29 2003/01/31 17:37:50 art Exp $ */ +/* $OpenBSD: kernfs_vnops.c,v 1.30 2003/03/30 22:28:05 rohee Exp $ */ /* $NetBSD: kernfs_vnops.c,v 1.43 1996/03/16 23:52:47 christos Exp $ */ /* @@ -342,8 +342,14 @@ kernfs_xread(kt, off, bufp, len) case KTT_STRING: { char *cp = kt->kt_data; + size_t len = strlen(cp); + + if (len && cp[len - 1] != '\n') { + strlcpy(*bufp, cp, KSTRING - 1); + strlcat(*bufp, "\n", KSTRING); + } else + *bufp = cp; - *bufp = cp; break; } |