Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170830014328.GB19925@brightrain.aerifal.cx>
Date: Tue, 29 Aug 2017 21:43:28 -0400
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: RTC_RD_TIME

On Tue, Aug 29, 2017 at 10:28:14PM +0100, Jorge Almeida wrote:
> A function to read the hardware clock (the battery powered thingy in
> the motherboard):
> 
> (man 4 rtc)
> 
> void read_hw(struct rtc_time* rtctime){
>    int rtcfd=open("/dev/rtc0" , O_RDONLY);
>    ioctl(rtcfd, RTC_RD_TIME, rtctime);
>    close(rtcfd);
> }
> 
> (error checking omitted)
> 
> The problem:
> warning: overflow in implicit constant conversion [-Woverflow]
> 
> (an arrow pointing to RTC_RD_TIME)
> 
> The same program compiles without warnings with glibc and dietlibc.

I don't know any good fix. The problem is that the glibc (and others')
ioctl function has a signature mismatching the standard one, with an
unsigned argument instead of signed, and the macro values are outside
the range of signed int. Fortunately the warning is harmless but
obviously it can impact builds with -Werror or policy about warnings..

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.