[PATCH] 64 bit clean compilation patches
Dan Yefimov
dan at D00M.lightwave.net.ru
Tue Nov 22 05:56:12 EST 2005
On Mon, 21 Nov 2005, Shaw Vrana wrote:
> Hello All,
>
> Attached is a patch against the portable openssh sources found at
> openssh at anoncvs.at.openbsd.org:/cvs. The majority of the size of the
> patch comes from changes to the build system to supply the required
> format specifications if they are not provided by the OS. These patches
> remove the following warnings found during a 64-bit compile:
>
> hostfile.c: In function `extract_salt':
> hostfile.c:92: warning: unsigned int format, different type arg (arg 2)
> progressmeter.c: In function `format_rate':
> progressmeter.c:91: warning: long long int format, off_t arg (arg 4)
> progressmeter.c:91: warning: long long int format, off_t arg (arg 5)
> progressmeter.c:91: warning: long long int format, off_t arg (arg 4)
> progressmeter.c:91: warning: long long int format, off_t arg (arg 5)
> progressmeter.c: In function `format_size':
> progressmeter.c:104: warning: long long int format, off_t arg (arg 4)
> progressmeter.c:104: warning: long long int format, off_t arg (arg 4)
> loginrec.c: In function `lastlog_get_entry':
> loginrec.c:1592: warning: int format, different type arg (arg 4)
> loginrec.c: In function `record_failed_login':
> loginrec.c:1655: warning: passing arg 3 of `getpeername' from
> incompatible pointer typescp.c:
> loginrec.c:1656: warning: passing arg 2 of `ipv64_normalise_mapped' from
> incompatible pointer type
> In function `source':
> scp.c:566: warning: long long int format, __off_t arg (arg 5)
> scp.c:566: warning: long long int format, __off_t arg (arg 5)
>
> These patches were tested on a 32-bit GNU/Linux machine with inttypes.h,
> 32-bit FreeBSD without inttypes.h, and a 64-bit GNU/Linux machine with
> inttypes.h.
>
Wouldn't it be much simpler to cast printf() arguments in question to
appropriate type or correct appropriate printf() format string modifiers
instead of doing such a big change? For example, in loginrec.c you could either
cast sizeof(last) result to int instead of int32_t or simply change
corresponding %d modifier to %u, as sizeof() result is of type unsigned int; in
progressmeter.c you could cast results of corresponding expressions to
long long type. The same applies to scp.c and sftp-server.c too.
--
Sincerely Your, Dan.
More information about the openssh-unix-dev
mailing list