summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen
diff options
context:
space:
mode:
authornectar <nectar@FreeBSD.org>2003-05-01 19:03:14 +0000
committernectar <nectar@FreeBSD.org>2003-05-01 19:03:14 +0000
commit0b64e1476ba01c6ba095af7d0623e93362281a12 (patch)
tree736595316c161b3d1ae559f331feaa6ba12b500e /lib/libc/gen
parent5ce8f7673e9083fdec888025823478cd3faf1ed7 (diff)
downloadFreeBSD-src-0b64e1476ba01c6ba095af7d0623e93362281a12.zip
FreeBSD-src-0b64e1476ba01c6ba095af7d0623e93362281a12.tar.gz
Back out the `hiding' of strlcpy and strlcat. Several people
vocally objected to this safety belt.
Diffstat (limited to 'lib/libc/gen')
-rw-r--r--lib/libc/gen/check_utility_compat.c9
-rw-r--r--lib/libc/gen/confstr.c5
-rw-r--r--lib/libc/gen/fmtmsg.c22
-rw-r--r--lib/libc/gen/getgrent.c4
-rw-r--r--lib/libc/gen/getpwent.c10
5 files changed, 25 insertions, 25 deletions
diff --git a/lib/libc/gen/check_utility_compat.c b/lib/libc/gen/check_utility_compat.c
index 2a0db43..0ccdec1 100644
--- a/lib/libc/gen/check_utility_compat.c
+++ b/lib/libc/gen/check_utility_compat.c
@@ -30,12 +30,15 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "namespace.h"
+/*
+ * I din't use "namespace.h" here because none of the relevant utilities
+ * are threaded, so I'm not concerned about cancellation points or other
+ * niceties.
+ */
#include <limits.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include "un-namespace.h"
#ifndef LINE_MAX
#define LINE_MAX _POSIX2_LINE_MAX
@@ -52,7 +55,7 @@ check_utility_compat(const char *utility)
int len;
if ((p = getenv(_ENV_UTIL_COMPAT)) != NULL) {
- _strlcpy(buf, p, sizeof buf);
+ strlcpy(buf, p, sizeof buf);
} else {
if ((len = readlink(_PATH_UTIL_COMPAT, buf, sizeof buf)) < 0)
return 0;
diff --git a/lib/libc/gen/confstr.c b/lib/libc/gen/confstr.c
index 2885afd..966c3fe 100644
--- a/lib/libc/gen/confstr.c
+++ b/lib/libc/gen/confstr.c
@@ -37,14 +37,13 @@ static char sccsid[] = "@(#)confstr.c 8.1 (Berkeley) 6/4/93";
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "namespace.h"
#include <sys/param.h>
+
#include <errno.h>
#include <limits.h>
#include <paths.h>
#include <string.h>
#include <unistd.h>
-#include "un-namespace.h"
size_t
@@ -115,7 +114,7 @@ confstr(int name, char *buf, size_t len)
docopy:
if (len != 0 && buf != NULL)
- _strlcpy(buf, p, len);
+ strlcpy(buf, p, len);
return (strlen(p) + 1);
default:
diff --git a/lib/libc/gen/fmtmsg.c b/lib/libc/gen/fmtmsg.c
index a9b4e60..6caabbb 100644
--- a/lib/libc/gen/fmtmsg.c
+++ b/lib/libc/gen/fmtmsg.c
@@ -27,12 +27,10 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "namespace.h"
#include <fmtmsg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include "un-namespace.h"
/* Default value for MSGVERB. */
#define DFLT_MSGVERB "label:severity:text:action:tag"
@@ -103,13 +101,13 @@ def:
#define INSERT_COLON \
if (*output != '\0') \
- _strlcat(output, ": ", size)
+ strlcat(output, ": ", size)
#define INSERT_NEWLINE \
if (*output != '\0') \
- _strlcat(output, "\n", size)
+ strlcat(output, "\n", size)
#define INSERT_SPACE \
if (*output != '\0') \
- _strlcat(output, " ", size)
+ strlcat(output, " ", size)
/*
* Returns NULL on memory allocation failure, otherwise returns a pointer to
@@ -141,20 +139,20 @@ printfmt(char *msgverb, long class, const char *label, int sev,
while ((comp = nextcomp(msgverb)) != NULL) {
if (strcmp(comp, "label") == 0 && label != MM_NULLLBL) {
INSERT_COLON;
- _strlcat(output, label, size);
+ strlcat(output, label, size);
} else if (strcmp(comp, "severity") == 0 && sevname != NULL) {
INSERT_COLON;
- _strlcat(output, sevinfo(sev), size);
+ strlcat(output, sevinfo(sev), size);
} else if (strcmp(comp, "text") == 0 && text != MM_NULLTXT) {
INSERT_COLON;
- _strlcat(output, text, size);
+ strlcat(output, text, size);
} else if (strcmp(comp, "action") == 0 && act != MM_NULLACT) {
INSERT_NEWLINE;
- _strlcat(output, "TO FIX: ", size);
- _strlcat(output, act, size);
+ strlcat(output, "TO FIX: ", size);
+ strlcat(output, act, size);
} else if (strcmp(comp, "tag") == 0 && tag != MM_NULLTAG) {
INSERT_SPACE;
- _strlcat(output, tag, size);
+ strlcat(output, tag, size);
}
}
INSERT_NEWLINE;
@@ -173,7 +171,7 @@ nextcomp(const char *msgverb)
char *retval;
if (*lmsgverb == '\0') {
- _strlcpy(lmsgverb, msgverb, sizeof(lmsgverb));
+ strlcpy(lmsgverb, msgverb, sizeof(lmsgverb));
retval = strtok_r(lmsgverb, ":", &state);
} else {
retval = strtok_r(NULL, ":", &state);
diff --git a/lib/libc/gen/getgrent.c b/lib/libc/gen/getgrent.c
index da50574..d834d09 100644
--- a/lib/libc/gen/getgrent.c
+++ b/lib/libc/gen/getgrent.c
@@ -620,7 +620,7 @@ dns_group(void *retval, void *mdata, va_list ap)
* pointer for the member list terminator.
*/
adjsize = bufsize - _ALIGNBYTES - sizeof(char *);
- linesize = _strlcpy(buffer, hes[0], adjsize);
+ linesize = strlcpy(buffer, hes[0], adjsize);
if (linesize >= adjsize) {
*errnop = ERANGE;
rv = NS_RETURN;
@@ -721,7 +721,7 @@ nis_group(void *retval, void *mdata, va_list ap)
rv = NS_NOTFOUND;
switch (how) {
case nss_lt_name:
- if (_strlcpy(buffer, name, bufsize) >= bufsize)
+ if (strlcpy(buffer, name, bufsize) >= bufsize)
goto erange;
break;
case nss_lt_id:
diff --git a/lib/libc/gen/getpwent.c b/lib/libc/gen/getpwent.c
index 256595b..427a736 100644
--- a/lib/libc/gen/getpwent.c
+++ b/lib/libc/gen/getpwent.c
@@ -584,7 +584,7 @@ files_passwd(void *retval, void *mdata, va_list ap)
/* MAXLOGNAME includes NUL byte, but we do not
* include the NUL byte in the key.
*/
- namesize = _strlcpy(&keybuf[1], name, sizeof(keybuf)-1);
+ namesize = strlcpy(&keybuf[1], name, sizeof(keybuf)-1);
if (namesize >= sizeof(keybuf)-1) {
*errnop = EINVAL;
rv = NS_NOTFOUND;
@@ -897,7 +897,7 @@ dns_passwd(void *retval, void *mdata, va_list ap)
hes = NULL;
continue;
}
- linesize = _strlcpy(buffer, hes[0], bufsize);
+ linesize = strlcpy(buffer, hes[0], bufsize);
if (linesize >= bufsize) {
*errnop = ERANGE;
rv = NS_RETURN;
@@ -1055,7 +1055,7 @@ nis_passwd(void *retval, void *mdata, va_list ap)
rv = NS_NOTFOUND;
switch (how) {
case nss_lt_name:
- if (_strlcpy(buffer, name, bufsize) >= bufsize)
+ if (strlcpy(buffer, name, bufsize) >= bufsize)
goto erange;
break;
case nss_lt_id:
@@ -1215,7 +1215,7 @@ compat_use_template(struct passwd *pwd, struct passwd *template, char *buffer,
hold.field = NULL; \
else { \
hold.field = p; \
- p += _strlcpy(p, pwd->field, eob-p) + 1; \
+ p += strlcpy(p, pwd->field, eob-p) + 1; \
} \
} while (0)
COPY(pw_name);
@@ -1233,7 +1233,7 @@ compat_use_template(struct passwd *pwd, struct passwd *template, char *buffer,
pwd->field = NULL; \
else { \
pwd->field = p; \
- if ((n = _strlcpy(p, q, eob-p)) >= eob-p) { \
+ if ((n = strlcpy(p, q, eob-p)) >= eob-p) { \
free(copy); \
return (ERANGE); \
} \
OpenPOWER on IntegriCloud