Backport patches to fix build with GCC 7
Luca Boccassi
6 years ago
|
0 |
From b651cb479235751b22b8f9a822a2fc6bc1be01ab Mon Sep 17 00:00:00 2001
|
|
1 |
From: Luca Boccassi <luca.boccassi@gmail.com>
|
|
2 |
Date: Tue, 7 Feb 2017 11:43:48 +0000
|
|
3 |
Subject: [PATCH 1/2] Problem: build error with GCC7 in zgossip_engine.inc
|
|
4 |
|
|
5 |
Solution: snprintf size parameter includes the NULL terminating char
|
|
6 |
as the manpage says, so don't pass sizeof(..) - 1
|
|
7 |
---
|
|
8 |
src/zgossip_engine.inc | 2 +-
|
|
9 |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
10 |
|
|
11 |
diff --git a/src/zgossip_engine.inc b/src/zgossip_engine.inc
|
|
12 |
index f66f76c1..b5596a8e 100644
|
|
13 |
--- a/src/zgossip_engine.inc
|
|
14 |
+++ b/src/zgossip_engine.inc
|
|
15 |
@@ -257,7 +257,7 @@ engine_set_log_prefix (client_t *client, const char *string)
|
|
16 |
{
|
|
17 |
if (client) {
|
|
18 |
s_client_t *self = (s_client_t *) client;
|
|
19 |
- snprintf (self->log_prefix, sizeof (self->log_prefix) - 1,
|
|
20 |
+ snprintf (self->log_prefix, sizeof (self->log_prefix),
|
|
21 |
"%6d:%-33s", self->unique_id, string);
|
|
22 |
}
|
|
23 |
}
|
|
24 |
--
|
|
25 |
2.11.0
|
|
26 |
|
|
0 |
From 41866333eccc5bcc6e18dc823efb5fa8748719ce Mon Sep 17 00:00:00 2001
|
|
1 |
From: Luca Boccassi <luca.boccassi@gmail.com>
|
|
2 |
Date: Tue, 7 Feb 2017 12:05:17 +0000
|
|
3 |
Subject: [PATCH 2/2] Problem: build error in zsys with GCC7
|
|
4 |
|
|
5 |
Solution: use a larger buffer for the PID buffer in zsys_run_as to
|
|
6 |
avoid a possible overflow.
|
|
7 |
---
|
|
8 |
src/zsys.c | 2 +-
|
|
9 |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
10 |
|
|
11 |
diff --git a/src/zsys.c b/src/zsys.c
|
|
12 |
index 13caf667..c0b60305 100644
|
|
13 |
--- a/src/zsys.c
|
|
14 |
+++ b/src/zsys.c
|
|
15 |
@@ -1135,7 +1135,7 @@ zsys_run_as (const char *lockfile, const char *group, const char *user)
|
|
16 |
}
|
|
17 |
}
|
|
18 |
// We record the current process id in the lock file
|
|
19 |
- char pid_buffer [10];
|
|
20 |
+ char pid_buffer [32];
|
|
21 |
snprintf (pid_buffer, sizeof (pid_buffer), "%6" PRIi64 "\n", (int64_t)getpid ());
|
|
22 |
if ((size_t) write (handle, pid_buffer, strlen (pid_buffer)) != strlen (pid_buffer)) {
|
|
23 |
zsys_error ("cannot write to lockfile: %s", strerror (errno));
|
|
24 |
--
|
|
25 |
2.11.0
|
|
26 |
|
4 | 4 |
0005-zsys_shutdown-does-not-call-zmq_term.patch
|
5 | 5 |
0006-public-API-changes-depending-on-libzmq-version.patch
|
6 | 6 |
0007-zhashx_purge-leak-when-shrinking.patch
|
|
7 |
0008-gcc7-zgossip-engine-fix.patch
|
|
8 |
0009-gcc7-zsys-fix.patch
|