Date: Sun, 12 Sep 2004 20:10:58 GMT From: Giorgos Keramidas <keramida@freebsd.org> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/71618: [PATCH] cleanup of the usr.sbin/timed code Message-ID: <200409122010.i8CKAwm1028214@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/71618; it has been noted by GNATS. From: Giorgos Keramidas <keramida@freebsd.org> To: Dan Lukes <dan@obluda.cz> Cc: bug-followup@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@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 :-)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200409122010.i8CKAwm1028214>