bin/71618: [PATCH] cleanup of the usr.sbin/timed code
keramida at freebsd.org
Sun Sep 12 13:10:58 PDT 2004
The following reply was made to PR bin/71618; it has been noted by GNATS.
From: Giorgos Keramidas <keramida at freebsd.org>
To: Dan Lukes <dan at obluda.cz>
Cc: bug-followup at freebsd.org
Subject: Re: bin/71618: [PATCH] cleanup of the usr.sbin/timed code
Date: Sun, 12 Sep 2004 21:35:35 +0300
On 2004-09-12 04:37, Dan Lukes <dan at obluda.cz> wrote:
> usr.sbin/timed/timed/readmsg.c:501: warning: long int format, int32_t arg (arg 6)
> usr.sbin/timed/timed/readmsg.c:501: warning: long int format, int32_t arg (arg 7)
> - fprintf(fd, "%s %d %-6u (%ld,%ld) %-15s %s\n",
> + fprintf(fd, "%s %d %-6u (%d,%d) %-15s %s\n",
There's no guarantee that an int32_t value will be defined with an `int'.
This might result in unexpected truncation of the printed value. A better
fix, IMHO, would be to change the format to %jd and then cast the value to
(intmax_t) which should avoid truncation of the value (you'll also have to
include <stdint.h> for intmax_t to be visible).
There are many other warnings in timed that are exposed if you try to build
it with an increased WARNS level. Since you seem to like doing this sort
of work, can you try the following (and see if you can come up with fixes
for the warnings this shows)?
# cd /usr/src/usr.sbin/timed/
# make NO_WERROR=1 WARNS?=3
Thank you for your work so far :-)
More information about the freebsd-bugs