summaryrefslogtreecommitdiffstats
path: root/lib/libc/string/strerror.c
diff options
context:
space:
mode:
authornectar <nectar@FreeBSD.org>2003-04-29 21:13:50 +0000
committernectar <nectar@FreeBSD.org>2003-04-29 21:13:50 +0000
commite69967f5348cec651f8806d25d2c59ac8ed8c2a2 (patch)
treee9749f1ff2693755bce73e10528fc8cc6a6563ea /lib/libc/string/strerror.c
parent975e4bcef1ba69d85a5c90f1849accc3cd74cb65 (diff)
downloadFreeBSD-src-e69967f5348cec651f8806d25d2c59ac8ed8c2a2.zip
FreeBSD-src-e69967f5348cec651f8806d25d2c59ac8ed8c2a2.tar.gz
`Hide' strlcpy and strlcat (using the namespace.h / __weak_reference
technique) so that we don't wind up calling into an application's version if the application defines them. Inspired by: qpopper's interfering and buggy version of strlcpy
Diffstat (limited to 'lib/libc/string/strerror.c')
-rw-r--r--lib/libc/string/strerror.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/libc/string/strerror.c b/lib/libc/string/strerror.c
index 02fba0c..0c20ac3 100644
--- a/lib/libc/string/strerror.c
+++ b/lib/libc/string/strerror.c
@@ -37,9 +37,11 @@ static char sccsid[] = "@(#)strerror.c 8.1 (Berkeley) 6/4/93";
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include "namespace.h"
#include <errno.h>
#include <stdio.h>
#include <string.h>
+#include "un-namespace.h"
#define UPREFIX "Unknown error: "
@@ -69,8 +71,8 @@ errstr(int num, char *buf, size_t len)
} while (uerr /= 10);
if (num < 0)
*--t = '-';
- strlcpy(buf, UPREFIX, len);
- strlcat(buf, t, len);
+ _strlcpy(buf, UPREFIX, len);
+ _strlcat(buf, t, len);
}
int
@@ -81,7 +83,7 @@ strerror_r(int errnum, char *strerrbuf, size_t buflen)
errstr(errnum, strerrbuf, buflen);
return (EINVAL);
}
- if (strlcpy(strerrbuf, sys_errlist[errnum], buflen) >= buflen)
+ if (_strlcpy(strerrbuf, sys_errlist[errnum], buflen) >= buflen)
return (ERANGE);
return (0);
}
OpenPOWER on IntegriCloud