bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH 1/2] pread: new module


From: Jim Meyering
Subject: Re: [PATCH 1/2] pread: new module
Date: Wed, 25 Nov 2009 18:02:18 +0100

Eric Blake wrote:

> Jim Meyering <jim <at> meyering.net> writes:
>
>> +  off_t old_offset = __libc_lseek (fd, 0, SEEK_CUR);
>
>> +Depends-on:
>> +unistd
>> +
>
> Needs to depend on lseek, particularly since pread is replaced on mingw, and
> mingw has an lseek bug with non-seekable files (like pipes).

First addressing these:
[Test improvements will follow.]

>From 23cd74133c81b80d335c701848b71d85a53402c6 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Wed, 25 Nov 2009 18:01:02 +0100
Subject: [PATCH] pread: improvement and fix

* modules/pread (Depends-on): Depend on lseek, for portability to
e.g., mingw.  Suggested by Eric Blake.
* lib/pread.c (__libc_read): Define.  Reported by Richard W.M. Jones.
---
 ChangeLog     |    5 +++++
 lib/pread.c   |    1 +
 modules/pread |    1 +
 3 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6128785..2e5f9fb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2009-11-25  Jim Meyering  <address@hidden>

+       pread: improvement and fix
+       * modules/pread (Depends-on): Depend on lseek, for portability to
+       e.g., mingw.  Suggested by Eric Blake.
+       * lib/pread.c (__libc_read): Define.  Reported by Richard W.M. Jones.
+
        unistd.in.h: correct declaration of pread
        * lib/unistd.in.h: Correct type of "buf" parameter: void*, not char*
        Reported by Richard W.M. Jones.
diff --git a/lib/pread.c b/lib/pread.c
index 632b914..7094ea7 100644
--- a/lib/pread.c
+++ b/lib/pread.c
@@ -23,6 +23,7 @@

 #define __libc_lseek(f,o,w) lseek (f, o, w)
 #define __set_errno(Val) errno = (Val)
+#define __libc_read(f,b,n) read (f, b, n)

 /* pread substitute for systems that the function, such as mingw32 and BeOS.  
*/
 /* The following is identical to the function from glibc's
diff --git a/modules/pread b/modules/pread
index 06039e6..4fb4424 100644
--- a/modules/pread
+++ b/modules/pread
@@ -6,6 +6,7 @@ lib/pread.c
 m4/pread.m4

 Depends-on:
+lseek
 unistd

 configure.ac:
--
1.6.6.rc0.236.ge0b94




reply via email to

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