From ad8ba6047d95c0856aeb0d013f83a0898328e39e Mon Sep 17 00:00:00 2001 From: Joerg Sonnenberger Date: Tue, 14 Sep 2004 17:52:25 +0000 Subject: [PATCH] Don't append '\n\0' to the return value of clnt_sperror if the string was already terminated at the place of the '\n'. --- lib/libc/rpc/clnt_perror.c | 8 +++++--- lib/libcr/rpc/clnt_perror.c | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/libc/rpc/clnt_perror.c b/lib/libc/rpc/clnt_perror.c index d5ae0baa8a..e39d92cfb5 100644 --- a/lib/libc/rpc/clnt_perror.c +++ b/lib/libc/rpc/clnt_perror.c @@ -29,7 +29,7 @@ * @(#)clnt_perror.c 1.15 87/10/07 Copyr 1984 Sun Micro * @(#)clnt_perror.c 2.1 88/07/29 4.0 RPCSRC * $FreeBSD: src/lib/libc/rpc/clnt_perror.c,v 1.11.2.1 2000/08/23 00:02:04 jhb Exp $ - * $DragonFly: src/lib/libc/rpc/clnt_perror.c,v 1.2 2003/06/17 04:26:44 dillon Exp $ + * $DragonFly: src/lib/libc/rpc/clnt_perror.c,v 1.3 2004/09/14 17:52:25 joerg Exp $ */ /* @@ -133,8 +133,10 @@ clnt_sperror(rpch, s) (long)e.re_lb.s1, (long)e.re_lb.s2); break; } - strstart[CLNT_PERROR_BUFLEN-2] = '\n'; - strstart[CLNT_PERROR_BUFLEN-1] = '\0'; + if (strstart[CLNT_PERROR_BUFLEN-2] != '\0') { + strstart[CLNT_PERROR_BUFLEN-2] = '\n'; + strstart[CLNT_PERROR_BUFLEN-1] = '\0'; + } return(strstart) ; } diff --git a/lib/libcr/rpc/clnt_perror.c b/lib/libcr/rpc/clnt_perror.c index 1fa3dc7d9e..3af0ccd61a 100644 --- a/lib/libcr/rpc/clnt_perror.c +++ b/lib/libcr/rpc/clnt_perror.c @@ -29,7 +29,7 @@ * @(#)clnt_perror.c 1.15 87/10/07 Copyr 1984 Sun Micro * @(#)clnt_perror.c 2.1 88/07/29 4.0 RPCSRC * $FreeBSD: src/lib/libc/rpc/clnt_perror.c,v 1.11.2.1 2000/08/23 00:02:04 jhb Exp $ - * $DragonFly: src/lib/libcr/rpc/Attic/clnt_perror.c,v 1.2 2003/06/17 04:26:44 dillon Exp $ + * $DragonFly: src/lib/libcr/rpc/Attic/clnt_perror.c,v 1.3 2004/09/14 17:52:25 joerg Exp $ */ /* @@ -133,8 +133,10 @@ clnt_sperror(rpch, s) (long)e.re_lb.s1, (long)e.re_lb.s2); break; } - strstart[CLNT_PERROR_BUFLEN-2] = '\n'; - strstart[CLNT_PERROR_BUFLEN-1] = '\0'; + if (strstart[CLNT_PERROR_BUFLEN-2] != '\0') { + strstart[CLNT_PERROR_BUFLEN-2] = '\n'; + strstart[CLNT_PERROR_BUFLEN-1] = '\0'; + } return(strstart) ; } -- 2.41.0