diff mbox series

[2/3] Revert "Introduce strlcpy() as string copy replacement"

Message ID 20201229153556.22996-3-bage@linutronix.de
State Rejected
Headers show
Series Build with libbsd for strlcpy | expand

Commit Message

Bastian Germann Dec. 29, 2020, 3:35 p.m. UTC
From: Bastian Germann <bage@linutronix.de>

This reverts commit ca00d834c6f335ac53ab97dfd8e64fce3c24f3c0.

Signed-off-by: Bastian Germann <bage@linutronix.de>
---
 core/util.c    | 22 ----------------------
 include/util.h |  5 -----
 2 files changed, 27 deletions(-)
diff mbox series

Patch

diff --git a/core/util.c b/core/util.c
index 6f5313e..2025276 100644
--- a/core/util.c
+++ b/core/util.c
@@ -223,28 +223,6 @@  char *substring(const char *src, int first, int len) {
 	return s;
 }
 
-#if defined(__linux__)
-size_t
-strlcpy(char *dst, const char * src, size_t size)
-{
-
-    size_t len = strlen(src);
-    /*
-     * src is null termintaed,
-     * copy the last '\0', too.
-     */
-    if (len < size) {
-        memcpy(dst, src, len + 1);
-    } else if (len) {
-	/* truncate string */
-        memcpy(dst, src, size - 1);
-	/* Add C string terminator */
-        dst[size - 1] = '\0';
-    }
-    return len;
-}
-#endif
-
 int openfileoutput(const char *filename)
 {
 	int fdout;
diff --git a/include/util.h b/include/util.h
index a0edd3e..e5a8955 100644
--- a/include/util.h
+++ b/include/util.h
@@ -181,11 +181,6 @@  int copy_write(void *out, const void *buf, unsigned int len);
 #if defined(__FreeBSD__)
 int copy_write_padded(void *out, const void *buf, unsigned int len);
 #endif
-#if defined(__linux__)
-/* strlcpy was originally developped in FreeBSD, not present in glibc */
-size_t
-strlcpy(char *dst, const char * src, size_t size);
-#endif
 int copyfile(int fdin, void *out, unsigned int nbytes, unsigned long *offs,
 	unsigned long long seek,
 	int skip_file, int compressed, uint32_t *checksum,