diff options
-rw-r--r-- | io.c | 6 | ||||
-rw-r--r-- | mkproto.awk | 2 | ||||
-rw-r--r-- | syscall.c | 9 | ||||
-rw-r--r-- | util.c | 2 |
4 files changed, 14 insertions, 5 deletions
@@ -238,7 +238,7 @@ static int last_sparse; int sparse_end(int f) { if (last_sparse) { - lseek(f,-1,SEEK_CUR); + do_lseek(f,-1,SEEK_CUR); return (write(f,&last_byte,1) == 1 ? 0 : -1); } last_sparse = 0; @@ -260,7 +260,7 @@ static int write_sparse(int f,char *buf,int len) last_sparse=1; if (l1 > 0) - lseek(f,l1,SEEK_CUR); + do_lseek(f,l1,SEEK_CUR); if (l1 == len) return len; @@ -271,7 +271,7 @@ static int write_sparse(int f,char *buf,int len) } if (l2 > 0) - lseek(f,l2,SEEK_CUR); + do_lseek(f,l2,SEEK_CUR); return len; } diff --git a/mkproto.awk b/mkproto.awk index 026b43b7..0e3f5bf3 100644 --- a/mkproto.awk +++ b/mkproto.awk @@ -23,7 +23,7 @@ BEGIN { next; } -!/^off_t|^pid_t|^unsigned|^mode_t|^DIR|^user|^int|^char|^uint|^struct|^BOOL|^void|^time/ { +!/^OFF_T|^off_t|^pid_t|^unsigned|^mode_t|^DIR|^user|^int|^char|^uint|^struct|^BOOL|^void|^time/ { next; } @@ -124,3 +124,12 @@ int do_fstat(int fd, STRUCT_STAT *st) return fstat(fd, st); #endif } + +OFF_T do_lseek(int fd, OFF_T offset, int whence) +{ +#if HAVE_OFF64_T + return lseek64(fd, offset, whence); +#else + return lseek(fd, offset, whence); +#endif +} @@ -83,7 +83,7 @@ char *map_ptr(struct map_struct *map,OFF_T offset,int len) map->p_size = len; } - if (lseek(map->fd,offset,SEEK_SET) != offset || + if (do_lseek(map->fd,offset,SEEK_SET) != offset || (nread=read(map->fd,map->p,len)) != len) { fprintf(FERROR,"EOF in map_ptr! (offset=%d len=%d nread=%d errno=%d)\n", (int)offset, len, nread, errno); |