From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/11868 Path: news.gmane.org!.POSTED!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: RTC_RD_TIME Date: Tue, 29 Aug 2017 21:43:28 -0400 Message-ID: <20170830014328.GB19925@brightrain.aerifal.cx> References: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1504057446 16648 195.159.176.226 (30 Aug 2017 01:44:06 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 30 Aug 2017 01:44:06 +0000 (UTC) User-Agent: Mutt/1.5.21 (2010-09-15) To: musl@lists.openwall.com Original-X-From: musl-return-11881-gllmg-musl=m.gmane.org@lists.openwall.com Wed Aug 30 03:43:58 2017 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1dms2a-0002vE-Eh for gllmg-musl@m.gmane.org; Wed, 30 Aug 2017 03:43:36 +0200 Original-Received: (qmail 29875 invoked by uid 550); 30 Aug 2017 01:43:41 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 29851 invoked from network); 30 Aug 2017 01:43:40 -0000 Content-Disposition: inline In-Reply-To: Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:11868 Archived-At: 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