Skip to content

Commit 55c7608

Browse files
author
r2
committed
fix: use glibc version to check builtin strlcat strlcpy
1 parent c037701 commit 55c7608

5 files changed

+47
-39
lines changed

patches/0001-util-poststat.c-fix-implicit-argument-problem.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
From aa8b578ab60f195b43dfa40e0a774bccf3027d78 Mon Sep 17 00:00:00 2001
1+
From 27c842876a57db50d92d26aa58643837006c38ee Mon Sep 17 00:00:00 2001
22
From: holishing <[email protected]>
33
Date: Sun, 28 Apr 2024 01:15:30 +0800
44
Subject: [PATCH 1/4] util/poststat.c: fix implicit argument problem

patches/0002-util-topusr.c-fix-implicit-argument-problem.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
From f11b7a528aa5f47a0bb3fa3039d5c13b382c2b02 Mon Sep 17 00:00:00 2001
1+
From f0cbeb372fa0b49dd47a321fa73de7112ad35b9e Mon Sep 17 00:00:00 2001
22
From: holishing <[email protected]>
33
Date: Sun, 28 Apr 2024 01:21:49 +0800
44
Subject: [PATCH 2/4] util/topusr.c: fix implicit argument problem

patches/0003-fix-let-str_iconv-input-compatible-with-iconv.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
From bfb32f58db6bb22a9b722b8b43c36767b5c744de Mon Sep 17 00:00:00 2001
1+
From fd478b1bcb01142dae93c66125a111aafb957b2b Mon Sep 17 00:00:00 2001
22
33
Date: Wed, 13 Aug 2025 14:41:49 +0800
44
Subject: [PATCH 3/4] fix: let str_iconv input compatible with iconv

patches/0004-fix-temp-workaround-to-use-strlcat-strlcpy-function-.patch

Lines changed: 0 additions & 36 deletions
This file was deleted.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
From bf02f61b1a228937a3429dc12422b048b925bb47 Mon Sep 17 00:00:00 2001
2+
3+
Date: Wed, 13 Aug 2025 16:39:39 +0800
4+
Subject: [PATCH 4/4] use glibc version to check builtin strlcat strlcpy
5+
6+
---
7+
include/osdep.h | 19 +++++++++++++++++--
8+
1 file changed, 17 insertions(+), 2 deletions(-)
9+
10+
diff --git a/include/osdep.h b/include/osdep.h
11+
index ed8bbd2a..23d86093 100644
12+
--- a/include/osdep.h
13+
+++ b/include/osdep.h
14+
@@ -18,10 +18,25 @@
15+
#include <sys/file.h> /* for flock() */
16+
#include <strings.h> /* for strcasecmp() */
17+
18+
-#if !defined(__has_builtin) || !__has_builtin(strlcpy)
19+
+#if defined __GLIBC_PREREQ && !defined __UCLIBC__
20+
+#define GLIBC_PREREQ(M, m) (__GLIBC_PREREQ(M, m))
21+
+#else
22+
+#define GLIBC_PREREQ(M, m) 0
23+
+#endif
24+
+
25+
+#ifndef LINUX_HAVE_STRLCPY
26+
+#define LINUX_HAVE_STRLCPY (GLIBC_PREREQ(2, 38) && __linux__)
27+
+#endif
28+
+
29+
+#ifndef LINUX_HAVE_STRLCAT
30+
+#define LINUX_HAVE_STRLCAT (GLIBC_PREREQ(2, 38) && __linux__)
31+
+#endif
32+
+
33+
+#ifndef LINUX_HAVE_STRLCPY
34+
#define NEED_STRLCPY
35+
#endif
36+
-#if !defined(__has_builtin) || !__has_builtin(strlcat)
37+
+
38+
+#ifndef LINUX_HAVE_STRLCAT
39+
#define NEED_STRLCAT
40+
#endif
41+
42+
--
43+
2.47.2
44+

0 commit comments

Comments
 (0)