public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix pread
@ 2005-03-20 14:52 Jakub Jelinek
  2005-03-20 16:51 ` Ulrich Drepper
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2005-03-20 14:52 UTC (permalink / raw)
  To: Ulrich Drepper, Roland McGrath; +Cc: Glibc hackers

Hi!

$ cat foo.c
#define _XOPEN_SOURCE 600
#define _FILE_OFFSET_BITS 64
#include <unistd.h>
$ gcc -D_FORTIFY_SOURCE=2 -O2 -c foo.c
In file included from /usr/include/unistd.h:1052,
                 from foo.c:3:
/usr/include/bits/unistd.h:55: error: conflicting types for `pread'
/usr/include/unistd.h:341: error: previous declaration of `pread' was here

Surprisingly, many __USE_FILE_OFFSET64 REDIRECTs use __off64_t rather than
__off_t.  This patch fixes this by adjusting posix/bits/unistd.h to match
unistd.h, but maybe better would be to change all the REDIRECTs to use
__off_t.

2005-03-20  Jakub Jelinek  <jakub@redhat.com>

	* posix/bits/unistd.h (pread) [__USE_FILE_OFFSET64]: Use __off64_t
	instead of __off_t for last argument.
	* debug/Makefile (tests): Add tst-lfschk{1,2,3}.
	* debug/tst-lfschk1.c: New test.
	* debug/tst-lfschk2.c: New test.
	* debug/tst-lfschk3.c: New test.

--- libc/posix/bits/unistd.h.jj	2005-03-19 08:36:13.000000000 +0100
+++ libc/posix/bits/unistd.h	2005-03-20 08:00:07.000000000 +0100
@@ -58,7 +58,7 @@ pread (int __fd, void *__buf, size_t __n
 }
 # else
 extern __always_inline __wur ssize_t
-pread (int __fd, void *__buf, size_t __nbytes, __off_t __offset)
+pread (int __fd, void *__buf, size_t __nbytes, __off64_t __offset)
 {
   if (__bos0 (__buf) != (size_t) -1
       && (!__builtin_constant_p (__nbytes) || __nbytes > __bos0 (__buf)))
--- libc/debug/tst-lfschk1.c.jj	2005-03-20 07:51:34.000000000 +0100
+++ libc/debug/tst-lfschk1.c	2005-03-20 07:51:17.000000000 +0100
@@ -0,0 +1,2 @@
+#define _FILE_OFFSET_BITS 64
+#include "tst-chk1.c"
--- libc/debug/tst-lfschk2.c.jj	2005-03-20 07:51:34.000000000 +0100
+++ libc/debug/tst-lfschk2.c	2005-03-20 07:51:41.000000000 +0100
@@ -0,0 +1,2 @@
+#define _FILE_OFFSET_BITS 64
+#include "tst-chk2.c"
--- libc/debug/tst-lfschk3.c.jj	2005-03-20 07:51:34.000000000 +0100
+++ libc/debug/tst-lfschk3.c	2005-03-20 07:51:45.000000000 +0100
@@ -0,0 +1,2 @@
+#define _FILE_OFFSET_BITS 64
+#include "tst-chk3.c"
--- libc/debug/Makefile.jj	2005-03-01 10:34:26.000000000 +0100
+++ libc/debug/Makefile	2005-03-20 07:52:18.000000000 +0100
@@ -54,7 +54,7 @@ CFLAGS-recv_chk.c = -fexceptions -fasync
 CFLAGS-recvfrom_chk.c = -fexceptions -fasynchronous-unwind-tables
 
 tests = backtrace-tst tst-chk1 tst-chk2 tst-chk3 \
-	test-strcpy_chk test-stpcpy_chk
+	tst-lfschk1 tst-lfschk2 tst-lfschk3 test-strcpy_chk test-stpcpy_chk
 
 extra-libs = libSegFault libpcprofile
 extra-libs-others = $(extra-libs)


	Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix pread
  2005-03-20 14:52 [PATCH] Fix pread Jakub Jelinek
@ 2005-03-20 16:51 ` Ulrich Drepper
  0 siblings, 0 replies; 2+ messages in thread
From: Ulrich Drepper @ 2005-03-20 16:51 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Glibc hackers

[-- Attachment #1: Type: text/plain, Size: 109 bytes --]

Applied.

--
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 251 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-03-20 16:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-20 14:52 [PATCH] Fix pread Jakub Jelinek
2005-03-20 16:51 ` Ulrich Drepper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).