summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--io.c6
-rw-r--r--mkproto.awk2
-rw-r--r--syscall.c9
-rw-r--r--util.c2
4 files changed, 14 insertions, 5 deletions
diff --git a/io.c b/io.c
index 0021d956..4e43d33c 100644
--- a/io.c
+++ b/io.c
@@ -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;
}
diff --git a/syscall.c b/syscall.c
index 10b32f84..a004d9d3 100644
--- a/syscall.c
+++ b/syscall.c
@@ -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
+}
diff --git a/util.c b/util.c
index e39f3cc1..f1665e3e 100644
--- a/util.c
+++ b/util.c
@@ -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);