1 From f81ca6161223e3566ce78a427571235fb6848fe9 Mon Sep 17 00:00:00 2001
2 From: Andreas Schneider <asn@cryptomilk.org>
3 Date: Wed, 29 Aug 2018 18:41:15 +0200
4 Subject: [PATCH 1/8] misc: Add strndup implementation if not provides by the
9 Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
10 (cherry picked from commit 247983e9820fd264cb5a59c14cc12846c028bd08)
11 Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
13 ConfigureChecks.cmake | 1 +
14 config.h.cmake | 3 +++
15 include/libssh/priv.h | 4 ++++
16 src/misc.c | 21 +++++++++++++++++++++
17 4 files changed, 29 insertions(+)
19 --- a/ConfigureChecks.cmake
20 +++ b/ConfigureChecks.cmake
21 @@ -115,6 +115,7 @@ endif (NOT WITH_GCRYPT)
23 check_function_exists(isblank HAVE_ISBLANK)
24 check_function_exists(strncpy HAVE_STRNCPY)
25 +check_function_exists(strndup HAVE_STRNDUP)
26 check_function_exists(strtoull HAVE_STRTOULL)
32 /* Define to 1 if you have the `strncpy' function. */
33 #cmakedefine HAVE_STRNCPY 1
35 +/* Define to 1 if you have the `strndup' function. */
36 +#cmakedefine HAVE_STRNDUP 1
38 /* Define to 1 if you have the `cfmakeraw' function. */
39 #cmakedefine HAVE_CFMAKERAW 1
41 --- a/include/libssh/priv.h
42 +++ b/include/libssh/priv.h
45 #endif /* !defined(HAVE_STRTOULL) */
47 +#if !defined(HAVE_STRNDUP)
48 +char *strndup(const char *s, size_t n);
49 +#endif /* ! HAVE_STRNDUP */
51 #ifdef HAVE_BYTESWAP_H
56 @@ -1028,6 +1028,27 @@ int ssh_match_group(const char *group, c
60 +#if !defined(HAVE_STRNDUP)
61 +char *strndup(const char *s, size_t n)
79 +#endif /* ! HAVE_STRNDUP */
83 /* vim: set ts=4 sw=4 et cindent: */