summaryrefslogtreecommitdiff
path: root/05/musl-0.6.0/src/string
diff options
context:
space:
mode:
Diffstat (limited to '05/musl-0.6.0/src/string')
-rw-r--r--05/musl-0.6.0/src/string/strdup.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/05/musl-0.6.0/src/string/strdup.c b/05/musl-0.6.0/src/string/strdup.c
index dd5f80c..defd559 100644
--- a/05/musl-0.6.0/src/string/strdup.c
+++ b/05/musl-0.6.0/src/string/strdup.c
@@ -10,4 +10,10 @@ char *__strdup(const char *s)
return memcpy(d, s, l+1);
}
-weak_alias(__strdup, strdup);
+char *strdup(const char *s)
+{
+ size_t l = strlen(s);
+ char *d = malloc(l+1);
+ if (!d) return NULL;
+ return memcpy(d, s, l+1);
+}