add support for lseek64() under solaris 2.6
authorAndrew Tridgell <tridge@samba.org>
Wed, 6 May 1998 06:34:18 +0000 (06:34 +0000)
committerAndrew Tridgell <tridge@samba.org>
Wed, 6 May 1998 06:34:18 +0000 (06:34 +0000)
io.c
mkproto.awk
syscall.c
util.c

diff --git a/io.c b/io.c
index 0021d95..4e43d33 100644 (file)
--- 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;
 }
index 026b43b..0e3f5bf 100644 (file)
@@ -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;
 }
 
index 10b32f8..a004d9d 100644 (file)
--- 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 e39f3cc..f1665e3 100644 (file)
--- 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);