OpenSSH warnings on FreeBSD

Darren Tucker dtucker at zip.com.au
Wed Dec 5 11:19:04 EST 2012


On Wed, Dec 5, 2012 at 6:00 AM, Eitan Adler <lists at eitanadler.com> wrote:
> On 4 December 2012 13:51, Arthur Mesh <amesh at juniper.net> wrote:
>> On Tue, Dec 04, 2012 at 04:05:51PM +0400, Loganaden Velvindron wrote:
>>> on FreeBSD, gcc complains that %d is used for sig_atomic_t
>>>
>>> Casting to (int) as a solution ?
>>
>> I think casting to intmax_t is a safer approach, together with changing
>> the format to %jd (although I am not sure how portable this is).

Not everything has an intmax_t, and it's not used anywhere else in
OpenSSH so in order to use it we'd need to add it to configure.

> I think this is the more portable approach among the two.

%jd isn't portable either (it's not in SuSv2, for example):
http://pubs.opengroup.org/onlinepubs/007908799/xsh/fprintf.html

Signal numbers have to fit into 7 bits (since they can be crammed into
the shell's return code with the high bit set) so casting to int
should be fine.

-- 
Darren Tucker (dtucker at zip.com.au)
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4  37C9 C982 80C7 8FF4 FA69
    Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.


More information about the openssh-unix-dev mailing list