summaryrefslogtreecommitdiff
path: root/sys/libkern
diff options
context:
space:
mode:
authorMatt Macy <mmacy@FreeBSD.org>2019-02-20 20:48:10 +0000
committerMatt Macy <mmacy@FreeBSD.org>2019-02-20 20:48:10 +0000
commit744799ead25f22feac7621611b98391d1c80037e (patch)
tree36171ccf2d57e4bc78b4a613a05dbd806cb603d7 /sys/libkern
parent281bdc30dfd58fdc27455100024bc8591d4e2faa (diff)
Notes
Diffstat (limited to 'sys/libkern')
-rw-r--r--sys/libkern/strdup.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/sys/libkern/strdup.c b/sys/libkern/strdup.c
index 8169c3594c88..5d0661966cd3 100644
--- a/sys/libkern/strdup.c
+++ b/sys/libkern/strdup.c
@@ -40,13 +40,22 @@ __FBSDID("$FreeBSD$");
#include <sys/malloc.h>
char *
-strdup(const char *string, struct malloc_type *type)
+strdup_flags(const char *string, struct malloc_type *type, int flags)
{
size_t len;
char *copy;
len = strlen(string) + 1;
- copy = malloc(len, type, M_WAITOK);
+ copy = malloc(len, type, flags);
+ if (copy == NULL)
+ return (NULL);
bcopy(string, copy, len);
return (copy);
}
+
+char *
+strdup(const char *string, struct malloc_type *type)
+{
+
+ return (strdup_flags(string, type, M_WAITOK));
+}