summaryrefslogtreecommitdiffstats
path: root/lib/libc/compat-43
diff options
context:
space:
mode:
authorphantom <phantom@FreeBSD.org>2005-02-27 14:51:27 +0000
committerphantom <phantom@FreeBSD.org>2005-02-27 14:51:27 +0000
commit7c1e0a15c75cb7e26dbd3de5bd72484334f59f28 (patch)
tree46f3f7a39f6b201dd220350e71fcd372ece9ad22 /lib/libc/compat-43
parent7157282f847f08c71e73df9c546ddec5e518b835 (diff)
downloadFreeBSD-src-7c1e0a15c75cb7e26dbd3de5bd72484334f59f28.zip
FreeBSD-src-7c1e0a15c75cb7e26dbd3de5bd72484334f59f28.tar.gz
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
Diffstat (limited to 'lib/libc/compat-43')
-rw-r--r--lib/libc/compat-43/getwd.c6
1 files changed, 2 insertions, 4 deletions
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 <unistd.h>
#include <errno.h>
#include <stdio.h>
-#include <string.h>
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);
}
OpenPOWER on IntegriCloud