Mark strlcat() and strlcpy() as weak functions, for libsyslog
The strlcat() and strlcpy() functions are only intended to be used by syslog.c internally (and syslogd), when building libsyslog. A user linking with libsyslog may have another library that provides strlcat() or strlcpy() replacements. We must therefore mark ours as weak functions so they can be overridden. This patch also add a convenience library for libsyslog, to control the build deps. for libsyslog. This is where external dependencies should be addded (explicitly) when syslog.c is updated from NetBSD. If you add new deps you likely want to mark them too as weak refs. Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
@ -16,6 +16,10 @@
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <compat.h>
|
||||
#ifndef HAVE_STRLCAT
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -27,7 +31,7 @@
|
||||
* If retval >= dsize, truncation occurred.
|
||||
*/
|
||||
size_t
|
||||
strlcat(char *dst, const char *src, size_t dsize)
|
||||
__strlcat(char *dst, const char *src, size_t dsize)
|
||||
{
|
||||
const char *odst = dst;
|
||||
const char *osrc = src;
|
||||
@ -53,3 +57,7 @@ strlcat(char *dst, const char *src, size_t dsize)
|
||||
|
||||
return(dlen + (src - osrc)); /* count does not include NUL */
|
||||
}
|
||||
|
||||
weak_alias(__strlcat, strlcat);
|
||||
|
||||
#endif /* HAVE_STRLCAT */
|
||||
|
Reference in New Issue
Block a user