Sign in
kernel
/
pub
/
scm
/
linux
/
kernel
/
git
/
axboe
/
fio
/
bc596cbcdbb58b81da53a29acf1370d8a7e94429
/
.
/
oslib
/
strndup.c
blob: 657904ab64d8044f71cce87b716743a21036186a [
file
] [
log
] [
blame
]
#ifndef
CONFIG_HAVE_STRNDUP
#include
<stdlib.h>
#include
<string.h>
#include
"strndup.h"
char
*
strndup
(
const
char
*
s
,
size_t
n
)
{
char
*
str
=
malloc
(
n
+
1
);
if
(
str
)
{
strncpy
(
str
,
s
,
n
);
str
[
n
]
=
'\0'
;
}
return
str
;
}
#endif