diff options
author | phantom <phantom@FreeBSD.org> | 2005-02-27 14:51:27 +0000 |
---|---|---|
committer | phantom <phantom@FreeBSD.org> | 2005-02-27 14:51:27 +0000 |
commit | 7c1e0a15c75cb7e26dbd3de5bd72484334f59f28 (patch) | |
tree | 46f3f7a39f6b201dd220350e71fcd372ece9ad22 /lib/libc/compat-43 | |
parent | 7157282f847f08c71e73df9c546ddec5e518b835 (diff) | |
download | FreeBSD-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.c | 6 |
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); } |