systemtap/staprun-fix-build-against-upcoming-gcc14.patch

31 lines
1.4 KiB
Diff
Raw Normal View History

From: Sergei Trofimovich <slyich@gmail.com>
Date: Thu Dec 21 10:00:06 2023 +0000
Subject: staprun: fix build against upcoming `gcc-14`
Git-commit: 52596f023652114642faba5726c99488529029ce
References: bsc#1221706
Signed-off-by: Tony Jones <tonyj@suse.de>
staprun: fix build against upcoming `gcc-14` (`-Werror=calloc-transposed-args`)
`gcc-14` added a new `-Wcalloc-transposed-args` warning recently. It
detected minor infelicity in `calloc()` API usage in `systemtap`:
staprun.c: In function 'main':
staprun.c:550:50: error: 'calloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Werror=calloc-transposed-args]
550 | char ** new_argv = calloc(sizeof(char *),argc+2);
| ^~~~
diff --git a/staprun/staprun.c b/staprun/staprun.c
index 8437f3af6..d1b0b221b 100644
--- a/staprun/staprun.c
+++ b/staprun/staprun.c
@@ -547,7 +547,7 @@ int main(int argc, char **argv)
us to extend argv[], with all the C fun that entails. */
#ifdef HAVE_OPENAT
if (relay_basedir_fd >= 0) {
- char ** new_argv = calloc(sizeof(char *),argc+2);
+ char ** new_argv = calloc(argc+2, sizeof(char *));
const int new_Foption_size = 10; /* -FNNNNN */
char * new_Foption = malloc(new_Foption_size);
int i;