Page MenuHomeFreeBSD

Fix format specifies type 'int' but the arguemnt has type 'long'
ClosedPublic

Authored by araujo on May 28 2015, 11:02 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Dec 15, 3:38 AM
Unknown Object (File)
Fri, Dec 12, 10:23 PM
Unknown Object (File)
Wed, Dec 3, 10:32 PM
Unknown Object (File)
Sun, Nov 30, 6:32 PM
Unknown Object (File)
Sun, Nov 30, 12:39 AM
Unknown Object (File)
Sat, Nov 22, 10:17 PM
Unknown Object (File)
Nov 21 2025, 7:07 AM
Unknown Object (File)
Nov 21 2025, 7:06 AM
Subscribers

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

araujo retitled this revision from to Fix format specifies type 'int' but the arguemnt has type 'long'.
araujo updated this object.
araujo edited the test plan for this revision. (Show Details)
araujo added a reviewer: rodrigc.
contrib/diff/src/context.c
65

This can't possibly be right. %j is the modifier for intmax_t.
You should have changed the second %.9d to %.9ld

Sorry for the noise and thanks to point it out.

rodrigc edited edge metadata.

This fix is wrong. You will get warnings on i386, which we still support building on.
A better fix would be to do:

sprintf(buf, "%jd.%.9jd", (intmax_t)sec, (intmax_t)nsec);
This revision now requires changes to proceed.May 28 2015, 6:59 PM
araujo edited edge metadata.

Apply rodrigc@ suggestion.

rodrigc edited edge metadata.
rodrigc added inline comments.
contrib/diff/src/context.c
65

OK, sorry to change my mind on this. I had to look at the code. In the function, we have:

long nsec ....
time_t sec ..........

I'm going to agree with @imp here.
I think this line should be

sprintf(buf, "%jd.%.9ld", (intmax_t)sec, nsec);
This revision now requires changes to proceed.May 31 2015, 5:33 AM
araujo edited edge metadata.

Rollback @imp first review.

rodrigc edited edge metadata.
This revision is now accepted and ready to land.May 31 2015, 4:10 PM