From 56e857a499a1bfb85707e1f9967478abddad1eee Mon Sep 17 00:00:00 2001 From: Murai Takashi Date: Wed, 28 Oct 2020 06:33:13 +0900 Subject: [PATCH] libs/util: Fix -Wformat= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I2ef917da71d4e436c274dfeb13386936e1c9d2d4 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3362 Reviewed-by: Jérôme Duval --- src/libs/util/pidfile.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/libs/util/pidfile.c b/src/libs/util/pidfile.c index 0c2d68aaa0..64336ea47f 100644 --- a/src/libs/util/pidfile.c +++ b/src/libs/util/pidfile.c @@ -10,7 +10,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD: src/lib/libutil/pidfile.c,v 1.3 2006/06/23 01:42:03 brian Ex #include #include #include +#include #include static int _pidfile_remove(struct pidfh *pfh, int freeit); @@ -135,7 +136,7 @@ pidfile_open(const char *path, mode_t mode, pid_t *pidptr) free(pfh); return (NULL); } - + ftruncate(fd, 0); /* @@ -187,7 +188,7 @@ pidfile_write(struct pidfh *pfh) return (-1); } - snprintf(pidstr, sizeof(pidstr), "%lu", getpid()); + snprintf(pidstr, sizeof(pidstr), "%" PRIu32, getpid()); if (pwrite(fd, pidstr, strlen(pidstr), 0) != (ssize_t)strlen(pidstr)) { error = errno; _pidfile_remove(pfh, 0);