From 75667314a9285c1e600b2ea09e93a63e2e976c12 Mon Sep 17 00:00:00 2001 From: Alexey Zelkin Date: Sun, 27 Feb 2005 14:51:27 +0000 Subject: [PATCH] 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(-) diff --git a/lib/libc/compat-43/getwd.c b/lib/libc/compat-43/getwd.c index 668dae07ada..280236e522e 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); }