mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-07-25 12:15:32 +03:00
48 lines
1.5 KiB
Diff
48 lines
1.5 KiB
Diff
From b66d2989e45605cf927fd0f2144696d320e08180 Mon Sep 17 00:00:00 2001
|
|
From: Roland Kammerer <roland.kammerer@linbit.com>
|
|
Date: Fri, 15 Jun 2018 16:16:45 +0200
|
|
Subject: [PATCH] build: check for strlcpy()
|
|
|
|
Check for stlcpy() and if found, disable the internal compat code.
|
|
|
|
This does not fix all cases, as we would also have to check for libbsd
|
|
and link with "-lbsd". Still, this helps Alpine, as their favorite libc
|
|
(musl) implements strlcpy().
|
|
---
|
|
configure.ac | 2 +-
|
|
rsync.c | 2 ++
|
|
2 files changed, 3 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/configure.ac b/configure.ac
|
|
index 741010f..f3ebff7 100644
|
|
--- a/configure.ac
|
|
+++ b/configure.ac
|
|
@@ -43,7 +43,7 @@ AM_CONDITIONAL([HAVE_PDFLATEX], test -n "$PDFLATEX")
|
|
|
|
|
|
dnl inspired by rsync's configure.ac
|
|
-AC_CHECK_FUNCS(fchmod setmode open64 mkstemp64)
|
|
+AC_CHECK_FUNCS(fchmod setmode open64 mkstemp64 strlcpy)
|
|
AC_CACHE_CHECK([for secure mkstemp],csync_cv_HAVE_SECURE_MKSTEMP,[
|
|
AC_TRY_RUN([#include <stdlib.h>
|
|
#include <sys/types.h>
|
|
diff --git a/rsync.c b/rsync.c
|
|
index 3eb6b3e..667a227 100644
|
|
--- a/rsync.c
|
|
+++ b/rsync.c
|
|
@@ -49,6 +49,7 @@
|
|
*
|
|
* @return index of the terminating byte.
|
|
**/
|
|
+#ifndef HAVE_STRLCPY
|
|
static size_t strlcpy(char *d, const char *s, size_t bufsize)
|
|
{
|
|
size_t len = strlen(s);
|
|
@@ -61,6 +62,7 @@ static size_t strlcpy(char *d, const char *s, size_t bufsize)
|
|
}
|
|
return ret;
|
|
}
|
|
+#endif
|
|
|
|
/* splits filepath at the last '/', if any, like so:
|
|
* dirname basename filepath
|