[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: examples/loadables/finfo.c type problems

From: Chet Ramey
Subject: Re: examples/loadables/finfo.c type problems
Date: Sun, 9 Sep 2018 14:33:10 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

On 9/7/18 5:28 PM, Christian Weisgerber wrote:
> Compiling examples/loadables/finfo.c (bash 4.4.23, 5.0-alpha) on
> OpenBSD produces various warnings about ill-matched types:

Yeah, it looks like OpenBSD has some unique type sizes here. Unfortunately,
there aren't portable printf format specifiers for `standard' Unix types.
The easiest fix is to add a bunch of sizeof() checks, or, equivalently,
add those checks to configure and end up with more SIZEOF_xxx defines, but
I haven't done that just for examples.

> I was thinking about how to fix those, but then I noticed existing bad
> casts in the code, e.g.,
>                 printf("%ld\n", (long) st->st_size);
> which potentially truncate values.

Pretty much all the systems bash runs on these days have 64-bit longs.
How big a file do you have? But the fix is the same as above.

``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    address@hidden    http://tiswww.cwru.edu/~chet/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]