mirror of
https://github.com/samba-team/samba.git
synced 2025-03-09 08:58:35 +03:00
added strndup() for systems that don't have it
This commit is contained in:
parent
51b4de0ae3
commit
7e92fb7453
1343
source/configure
vendored
1343
source/configure
vendored
File diff suppressed because it is too large
Load Diff
@ -601,7 +601,7 @@ else
|
||||
RUNPROG=""
|
||||
fi
|
||||
|
||||
AC_CHECK_FUNCS(dlopen dlclose dlsym dlerror waitpid getcwd strdup strtoul strerror chown fchown chmod fchmod chroot link mknod mknod64)
|
||||
AC_CHECK_FUNCS(dlopen dlclose dlsym dlerror waitpid getcwd strdup strndup strtoul strerror chown fchown chmod fchmod chroot link mknod mknod64)
|
||||
AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync bzero memset strlcpy strlcat setpgid)
|
||||
AC_CHECK_FUNCS(memmove vsnprintf snprintf asprintf vasprintf setsid glob strpbrk pipe crypt16 getauthuid)
|
||||
AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction sigset innetgr setnetgrent getnetgrent endnetgrent)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* include/config.h.in. Generated automatically from configure.in by autoheader. */
|
||||
/* include/config.h.in. Generated automatically from configure.in by autoheader 2.13. */
|
||||
|
||||
/* Define if on AIX 3.
|
||||
System headers sometimes define this.
|
||||
@ -806,6 +806,9 @@
|
||||
/* Define if you have the strlcpy function. */
|
||||
#undef HAVE_STRLCPY
|
||||
|
||||
/* Define if you have the strndup function. */
|
||||
#undef HAVE_STRNDUP
|
||||
|
||||
/* Define if you have the strpbrk function. */
|
||||
#undef HAVE_STRPBRK
|
||||
|
||||
|
@ -982,3 +982,22 @@ int fstr_sprintf(fstring s, const char *fmt, ...)
|
||||
va_end(ap);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
#ifndef HAVE_STRNDUP
|
||||
/*******************************************************************
|
||||
some platforms don't have strndup
|
||||
********************************************************************/
|
||||
char *strndup(const char *s, size_t n)
|
||||
{
|
||||
char *ret;
|
||||
int i;
|
||||
for (i=0;s[i] && i<n;i++) ;
|
||||
|
||||
ret = malloc(i+1);
|
||||
if (!ret) return NULL;
|
||||
memcpy(ret, s, i);
|
||||
ret[i] = 0;
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user