ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/preadwrite.c
(Generate patch)

Comparing ray/src/common/preadwrite.c (file contents):
Revision 3.1 by greg, Sat Feb 22 02:07:22 2003 UTC vs.
Revision 3.2 by greg, Mon Oct 20 16:01:55 2003 UTC

# Line 5 | Line 5 | static const char      RCSid[] = "$Id$";
5   * Substitute routines for pread(2) and pwrite(2)
6   */
7  
8 < extern off_t    lseek();
8 > #include "platform.h"
9  
10  
11   int
# Line 13 | Line 13 | pread(fd, buf, siz, offs)      /* read buffer from an open
13   int     fd;
14   char    *buf;
15   unsigned int    siz;
16 < long    pos;
16 > long    offs;
17   {
18 <        if (lseek(fd, (off_t)offs, 0) != offs)
18 >        if (lseek(fd, (off_t)offs, SEEK_SET) != offs)
19                  return(-1);
20          return(read(fd, buf, siz));
21                                  /* technically, we should reset pointer here */
# Line 27 | Line 27 | pwrite(fd, buf, siz, offs)     /* write buffer to an open
27   int     fd;
28   char    *buf;
29   unsigned int    siz;
30 < long    pos;
30 > long    offs;
31   {
32 <        if (lseek(fd, (off_t)offs, 0) != offs)
32 >        if (lseek(fd, (off_t)offs, SEEK_SET) != offs)
33                  return(-1);
34          return(write(fd, buf, siz));
35                                  /* technically, we should reset pointer here */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines