configure: remember to initialize 'strndup' to "no"
[fio.git] / oslib / strndup.c
CommitLineData
b29c71c4
JA
1#include <stdlib.h>
2#include <string.h>
3
4#ifndef CONFIG_HAVE_STRNDUP
5
6char *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