projects
/
fio.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
blame
|
history
|
raw
|
HEAD
Add strndup() function, if we don't have it
[fio.git]
/
oslib
/
strndup.c
1
#include <stdlib.h>
2
#include <string.h>
3
4
#ifndef CONFIG_HAVE_STRNDUP
5
6
char *strndup(const char *s, size_t n)
7
{
8
char *str = malloc(n + 1);
9
10
if (str) {
11
strncpy(str, s, n);
12
str[n] = '\0';
13
}
14
15
return str;
16
}
17
18
#endif