From 7c1e0a15c75cb7e26dbd3de5bd72484334f59f28 Mon Sep 17 00:00:00 2001 From: phantom Date: Sun, 27 Feb 2005 14:51:27 +0000 Subject: Replace usage of strerror()/strcpy() with strerror_r() here, reducing number of required operations to get error message and avoiding of strerror's buffer clobbering. Also ANSI'fy prototypes while I'm here --- lib/libc/compat-43/getwd.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'lib/libc') diff --git a/lib/libc/compat-43/getwd.c b/lib/libc/compat-43/getwd.c index 668dae0..280236e 100644 --- a/lib/libc/compat-43/getwd.c +++ b/lib/libc/compat-43/getwd.c @@ -41,16 +41,14 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include char * -getwd(buf) - char *buf; +getwd(char *buf) { char *p; if ( (p = getcwd(buf, MAXPATHLEN)) ) return(p); - (void)strcpy(buf, strerror(errno)); + (void)strerror_r(errno, buf, MAXPATHLEN); return((char *)NULL); } -- cgit v1.1