summaryrefslogtreecommitdiff
path: root/src/string/strdup.c
blob: 26362e2f5a9ebc5d57c20d5c9cd944991003508f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <string.h>
#include <stdlib.h>
#include "_safety.h"
#undef strdup

char * strdup(const char *s)
{
	SIGNAL_SAFE(0);

	size_t len = strlen(s);
	char *ret = malloc(len + 1);
	if (ret) {
		strcpy(ret, s);
	}
	return ret;
}

/*
XOPEN(400)
POSIX(200809)
*/