libs/util: Fix -Wformat=

Change-Id: I2ef917da71d4e436c274dfeb13386936e1c9d2d4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3362
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
This commit is contained in:
Murai Takashi 2020-10-28 06:33:13 +09:00 committed by Jérôme Duval
parent 18112d73b2
commit 56e857a499

View File

@ -38,6 +38,7 @@ __FBSDID("$FreeBSD: src/lib/libutil/pidfile.c,v 1.3 2006/06/23 01:42:03 brian Ex
#include <string.h> #include <string.h>
#include <err.h> #include <err.h>
#include <errno.h> #include <errno.h>
#include <inttypes.h>
#include <libutil.h> #include <libutil.h>
static int _pidfile_remove(struct pidfh *pfh, int freeit); static int _pidfile_remove(struct pidfh *pfh, int freeit);
@ -187,7 +188,7 @@ pidfile_write(struct pidfh *pfh)
return (-1); 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)) { if (pwrite(fd, pidstr, strlen(pidstr), 0) != (ssize_t)strlen(pidstr)) {
error = errno; error = errno;
_pidfile_remove(pfh, 0); _pidfile_remove(pfh, 0);