blob: 8f1c4b9b9b439ebfa21c83c2987dcd0a21a956ae [file] [log] [blame]
Brad Bishop19323692019-04-05 15:28:33 -04001From 8321f8b3befbaa355cfed988fdd8494133989676 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 4 Feb 2019 00:38:16 -0800
4Subject: [PATCH] hook: Do not append int to std::string
5
6Clang find this error
7
8| ../../../git/sysdeps/linux-gnu/hooks.c:205:51: error: adding 'int' to a string does not append to the string [-Werror,-Wstring-plus
9-int]
10| || sprintf(syspath, "%s/%s", sysconfdir, FN + 1) < 0)
11| ~~~^~~
12
13Upstream-Status: Pending
14Signed-off-by: Khem Raj <raj.khem@gmail.com>
15---
16 sysdeps/linux-gnu/hooks.c | 2 +-
17 1 file changed, 1 insertion(+), 1 deletion(-)
18
19--- a/sysdeps/linux-gnu/hooks.c
20+++ b/sysdeps/linux-gnu/hooks.c
21@@ -200,9 +200,10 @@ os_get_ltrace_conf_filenames(struct vect
22 const char *sysconfdir = SYSCONFDIR;
23 if (sysconfdir != NULL && *sysconfdir != '\0') {
24 /* No +1, we skip the initial period. */
25- syspath = malloc(strlen(sysconfdir) + sizeof FN);
26+ syspath = malloc(strlen(sysconfdir) + sizeof FN + 1);
27+ syspath[strlen(sysconfdir) + sizeof FN + 1] = '\0';
28 if (syspath == NULL
29- || sprintf(syspath, "%s/%s", sysconfdir, FN + 1) < 0)
30+ || sprintf(syspath, "%s/%s", sysconfdir, FN) < 0)
31 goto fail;
32 }
33