csync2: keep strlcpy for glibc, disable for musl
This commit is contained in:
parent
3396588daa
commit
fe1c1a4c4e
18
srcpkgs/csync2/patches/musl-strlcpy.patch
Normal file
18
srcpkgs/csync2/patches/musl-strlcpy.patch
Normal file
|
@ -0,0 +1,18 @@
|
|||
--- rsync.c 2015-03-09 15:08:51.000000000 +0100
|
||||
+++ rsync.c 2015-10-06 16:44:57.988159380 +0200
|
||||
@@ -39,6 +39,7 @@
|
||||
#endif
|
||||
|
||||
|
||||
+#if defined(__GLIBC__)
|
||||
/* This has been taken from rsync:lib/compat.c */
|
||||
|
||||
/**
|
||||
@@ -61,6 +62,7 @@
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
+#endif
|
||||
|
||||
/* splits filepath at the last '/', if any, like so:
|
||||
* dirname basename filepath
|
|
@ -1,36 +0,0 @@
|
|||
The declaration of strlcpy conflicts with the musl libc
|
||||
implementation. The libc (GNU or musl) implementation
|
||||
should be sufficient in any case.
|
||||
|
||||
--- rsync.c 2015-03-09 15:08:51.000000000 +0100
|
||||
+++ rsync.c 2015-10-06 16:39:10.499186490 +0200
|
||||
@@ -39,29 +39,6 @@
|
||||
#endif
|
||||
|
||||
|
||||
-/* This has been taken from rsync:lib/compat.c */
|
||||
-
|
||||
-/**
|
||||
- * Like strncpy but does not 0 fill the buffer and always null
|
||||
- * terminates.
|
||||
- *
|
||||
- * @param bufsize is the size of the destination buffer.
|
||||
- *
|
||||
- * @return index of the terminating byte.
|
||||
- **/
|
||||
-static size_t strlcpy(char *d, const char *s, size_t bufsize)
|
||||
-{
|
||||
- size_t len = strlen(s);
|
||||
- size_t ret = len;
|
||||
- if (bufsize > 0) {
|
||||
- if (len >= bufsize)
|
||||
- len = bufsize-1;
|
||||
- memcpy(d, s, len);
|
||||
- d[len] = 0;
|
||||
- }
|
||||
- return ret;
|
||||
-}
|
||||
-
|
||||
/* splits filepath at the last '/', if any, like so:
|
||||
* dirname basename filepath
|
||||
* "/" "" "/"
|
Loading…
Reference in New Issue
Block a user