Page MenuHomeFreeBSD

D19259.diff
No OneTemporary

D19259.diff

Index: head/sys/libkern/strdup.c
===================================================================
--- head/sys/libkern/strdup.c
+++ head/sys/libkern/strdup.c
@@ -40,13 +40,22 @@
#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));
}
Index: head/sys/sys/libkern.h
===================================================================
--- head/sys/sys/libkern.h
+++ head/sys/sys/libkern.h
@@ -173,6 +173,7 @@
int strcmp(const char *, const char *);
char *strcpy(char * __restrict, const char * __restrict);
size_t strcspn(const char * __restrict, const char * __restrict) __pure;
+char *strdup_flags(const char *__restrict, struct malloc_type *, int);
char *strdup(const char *__restrict, struct malloc_type *);
char *strncat(char *, const char *, size_t);
char *strndup(const char *__restrict, size_t, struct malloc_type *);

File Metadata

Mime Type
text/plain
Expires
Sat, Jul 4, 10:16 AM (3 h, 44 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34663995
Default Alt Text
D19259.diff (1 KB)

Event Timeline