X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:from:to:subject:date:message-id:references
	:in-reply-to:content-type:content-transfer-encoding
	:mime-version; q=dns; s=default; b=lrUmZH0qSVXcN3Eoc/Pf40VrTBtJ6
	8AyJ1Oy6ACxdUpI66C0r7y6ExEf2b5t5Pu7f2TvqhM5EODm5j597IzF5ZNZXV9xE
	x44xrc2ZD+4tV1YAsdMM1kCYa3iZMtBZ9xJZ+cgx2cgZYxXrkDUcxmoOrX93aY31
	5TNnr3r6o5umCs=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:from:to:subject:date:message-id:references
	:in-reply-to:content-type:content-transfer-encoding
	:mime-version; s=default; bh=QJJHKbzYKvmeXBKBNw2T99pT4Hs=; b=Zfr
	g+UbH7570wNyayJlhbvG0ls1gJ1Zg3zow/z+tWgc9TWfR57KixrdIWnGkgqBypoR
	Jx1CbmI65AMLvgWxY2o7fvYZ2uguURZxt3kZSAFKd8ufsnDNHwFaEp0vS6Tk78oY
	/nJoNPPamH9YVqwa8u7W7aBHecVvST/rfH0BuW4o=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-0.1 required=5.0 tests=AWL,BAYES_00,MIME_BASE64_BLANKS autolearn=ham version=3.3.2
X-HELO: USA7109MR004.ACS-INC.COM
From: "Nellis, Kenneth" <Kenneth.Nellis@xerox.com>
To: "cygwin@cygwin.com" <cygwin@cygwin.com>
Subject: RE: open(O_RDWR) and lseek() fail
Date: Fri, 28 Mar 2014 12:53:31 +0000
Message-ID: <0D835E9B9CD07F40A48423F80D3B5A702CE06F27@USA7109MB022.na.xerox.net>
References: <20140328093110.GA23367@calimero.vinschen.de>
In-Reply-To: <20140328093110.GA23367@calimero.vinschen.de>
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id s2SCrnKS025409

From: Corinna Vinschen
> It doesn't matter what you use, it matters what the function expects.
> lseek expects off_t per POSIX:
> 
> http://pubs.opengroup.org/onlinepubs/9699919799/functions/lseek.html
> 
> and off_t is defined as 64 bit type.

After adding the missing unistd.h and return statements, gcc -Wall still
complains:

x.c: In function ‘main’:
x.c:12:2: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘off_t’ [-Wformat=]
  printf("pos = %d\n",lseek(f, 0l, SEEK_CUR));
  ^
x.c:12:2: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘off_t’ [-Wformat=]

So, then, after changing %d to %lld, gcc -Wall -pedantic complains:

x.c: In function ‘main’:
x.c:12:2: warning: ISO C90 does not support the ‘ll’ gnu_printf length modifier [-Wformat=]
  printf("pos = %lld\n",lseek(f, 0l, SEEK_CUR));
  ^
x.c:12:2: warning: ISO C90 does not support the ‘ll’ gnu_printf length modifier [-Wformat=]

Wondering how to printf an off_t value without the compiler complaining while
using -Wall -pedantic.

--Ken Nellis

