czmq: Fix build with gcc-7

This commit is contained in:
adisbladis 2017-11-17 15:04:00 +08:00
parent 3ac474aee6
commit f9cb7a0322
No known key found for this signature in database
GPG Key ID: ED58F95069B004F5
3 changed files with 36 additions and 1 deletions

View File

@ -9,6 +9,8 @@ stdenv.mkDerivation rec {
sha256 = "16k9awrhdsymx7dnmvqcnkaq8lz8x8zppy6sh7ls8prpd6mkkjlb";
};
patches = [ ./czmq3-gcc7.patch ];
# Fix build on Glibc 2.24.
NIX_CFLAGS_COMPILE = "-Wno-error=deprecated-declarations";

View File

@ -1,4 +1,4 @@
{ stdenv, fetchurl, zeromq }:
{ stdenv, fetchurl, fetchpatch, zeromq }:
stdenv.mkDerivation rec {
version = "4.0.2";
@ -9,6 +9,13 @@ stdenv.mkDerivation rec {
sha256 = "12gbh57xnz2v82x1g80gv4bwapmyzl00lbin5ix3swyac8i7m340";
};
patches = [
(fetchpatch {
url = https://patch-diff.githubusercontent.com/raw/zeromq/czmq/pull/1618.patch;
sha256 = "1dssy7k0fni6djail8rz0lk8p777158jvrqhgn500i636gkxaxhp";
})
];
# Needs to be propagated for the .pc file to work
propagatedBuildInputs = [ zeromq ];

View File

@ -0,0 +1,26 @@
diff --git a/src/zgossip_engine.inc b/src/zgossip_engine.inc
index 37dbb4eb..727aaa9b 100644
--- a/src/zgossip_engine.inc
+++ b/src/zgossip_engine.inc
@@ -258,7 +258,7 @@ engine_set_log_prefix (client_t *client, const char *string)
{
if (client) {
s_client_t *self = (s_client_t *) client;
- snprintf (self->log_prefix, sizeof (self->log_prefix) - 1,
+ snprintf (self->log_prefix, sizeof (self->log_prefix),
"%6d:%-33s", self->unique_id, string);
}
}
diff --git a/src/zsys.c b/src/zsys.c
index 4d0bb8a1..f07db9c8 100644
--- a/src/zsys.c
+++ b/src/zsys.c
@@ -1071,7 +1071,7 @@ zsys_run_as (const char *lockfile, const char *group, const char *user)
}
}
// We record the current process id in the lock file
- char pid_buffer [10];
+ char pid_buffer [32];
snprintf (pid_buffer, sizeof (pid_buffer), "%6d\n", getpid ());
if (write (handle, pid_buffer, strlen (pid_buffer)) != strlen (pid_buffer)) {
zsys_error ("cannot write to lockfile: %s", strerror (errno));