BUILD: mworker: silence two printf format warnings around getpid()
getpid() is documented as returning a pit pid_t result, not
necessarily an int. This causes a build warning on Solaris 10
because of '%d' or '%u' are used in the format passed to snprintf().
Let's just cast the result as an int (respectively unsigned int).
This can be backported to 2.0 and possibly older versions though
it really has no impact.
(cherry picked from commit 76a80c710cbd8ca3d7dcd191d26cc7a450dee22e)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/src/haproxy.c b/src/haproxy.c
index 47cd915..617116c 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -3009,7 +3009,7 @@
/* if in master-worker mode, write the PID of the father */
if (global.mode & MODE_MWORKER) {
char pidstr[100];
- snprintf(pidstr, sizeof(pidstr), "%d\n", getpid());
+ snprintf(pidstr, sizeof(pidstr), "%d\n", (int)getpid());
if (pidfd >= 0)
shut_your_big_mouth_gcc(write(pidfd, pidstr, strlen(pidstr)));
}