diff mbox series

[oe,meta-oe,V2,6/6] ltrace: Fix build with clang

Message ID 20190206004547.32351-6-raj.khem@gmail.com
State Accepted
Commit 1a502b3086d0490afb527fb919f1d5e051dd8e43
Headers show
Series [oe,meta-oe,1/6] catch2: Upgrade to 2.6.0 | expand

Commit Message

Khem Raj Feb. 6, 2019, 12:45 a.m. UTC
Signed-off-by: Khem Raj <raj.khem@gmail.com>

---
v2: Fix build regression with gcc

 ...hook-Do-not-append-int-to-std-string.patch | 33 +++++++++++++++++++
 meta-oe/recipes-devtools/ltrace/ltrace_git.bb |  1 +
 2 files changed, 34 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/ltrace/ltrace/0001-hook-Do-not-append-int-to-std-string.patch

-- 
2.20.1

-- 
_______________________________________________
Openembedded-devel mailing list
Openembedded-devel@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-devel
diff mbox series

Patch

diff --git a/meta-oe/recipes-devtools/ltrace/ltrace/0001-hook-Do-not-append-int-to-std-string.patch b/meta-oe/recipes-devtools/ltrace/ltrace/0001-hook-Do-not-append-int-to-std-string.patch
new file mode 100644
index 0000000000..8f1c4b9b9b
--- /dev/null
+++ b/meta-oe/recipes-devtools/ltrace/ltrace/0001-hook-Do-not-append-int-to-std-string.patch
@@ -0,0 +1,33 @@ 
+From 8321f8b3befbaa355cfed988fdd8494133989676 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 4 Feb 2019 00:38:16 -0800
+Subject: [PATCH] hook: Do not append int to std::string
+
+Clang find this error
+
+| ../../../git/sysdeps/linux-gnu/hooks.c:205:51: error: adding 'int' to a string does not append to the string [-Werror,-Wstring-plus
+-int]
+|                     || sprintf(syspath, "%s/%s", sysconfdir, FN + 1) < 0)
+|                                                              ~~~^~~
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ sysdeps/linux-gnu/hooks.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/sysdeps/linux-gnu/hooks.c
++++ b/sysdeps/linux-gnu/hooks.c
+@@ -200,9 +200,10 @@ os_get_ltrace_conf_filenames(struct vect
+ 	const char *sysconfdir = SYSCONFDIR;
+ 	if (sysconfdir != NULL && *sysconfdir != '\0') {
+ 		/* No +1, we skip the initial period.  */
+-		syspath = malloc(strlen(sysconfdir) + sizeof FN);
++		syspath = malloc(strlen(sysconfdir) + sizeof FN + 1);
++		syspath[strlen(sysconfdir) + sizeof FN + 1] = '\0';
+ 		if (syspath == NULL
+-		    || sprintf(syspath, "%s/%s", sysconfdir, FN + 1) < 0)
++		    || sprintf(syspath, "%s/%s", sysconfdir, FN) < 0)
+ 			goto fail;
+ 	}
+ 
diff --git a/meta-oe/recipes-devtools/ltrace/ltrace_git.bb b/meta-oe/recipes-devtools/ltrace/ltrace_git.bb
index 83043cd212..3dc269c80e 100644
--- a/meta-oe/recipes-devtools/ltrace/ltrace_git.bb
+++ b/meta-oe/recipes-devtools/ltrace/ltrace_git.bb
@@ -26,6 +26,7 @@  SRC_URI = "git://github.com/sparkleholic/ltrace.git;branch=master;protocol=http
            file://0001-configure-Recognise-linux-musl-as-a-host-OS.patch \
            file://0001-mips-plt.c-Delete-include-error.h.patch \
            file://0001-move-fprintf-into-same-block-where-modname-and-symna.patch \
+           file://0001-hook-Do-not-append-int-to-std-string.patch \
            "
 S = "${WORKDIR}/git"