diff options
author | Jeremy Allison <jra@samba.org> | 1998-09-03 18:40:31 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 1998-09-03 18:40:31 +0000 |
commit | 7bb86c1b132bce31a006ea9768a54db7a45fe1a5 (patch) | |
tree | 1802e8e2741345e91187fc4b149016af75990971 /source3/locking/locking_slow.c | |
parent | 4acd373e5bbd615141ceb5fb3c4a588a5b4581d7 (diff) | |
download | samba-7bb86c1b132bce31a006ea9768a54db7a45fe1a5.tar.gz samba-7bb86c1b132bce31a006ea9768a54db7a45fe1a5.tar.bz2 samba-7bb86c1b132bce31a006ea9768a54db7a45fe1a5.zip |
Ok - this is the 64 bit widening check in. It changes the configure
to check for stat64 and friends, and then changes much of Samba
to use the data type SMB_OFF_T for file size information.
stat/fstat/lstat/lseek/ftruncate have now become sys_stat etc. to hide
the 64 bit calls if needed.
Note that this still does not expose 64 bit functionality to the
client, as the changes to the reply_xxx smb's are not yet done.
This code change should make these changes possible.
Still to do before full 64 bit-ness to the client:
fcntl lock code.
statfs code
widening of dev_t and ino_t (now possible due to SMB_DEV_T and SMB_OFF_T
types being in place).
Let me know if wierd things happen after this check-in and I'll
fix them :-).
Jeremy.
(This used to be commit 14500936c321d15995c963766aac67bf1f4e3824)
Diffstat (limited to 'source3/locking/locking_slow.c')
-rw-r--r-- | source3/locking/locking_slow.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/source3/locking/locking_slow.c b/source3/locking/locking_slow.c index 4c2ba43cd8..c242baec4a 100644 --- a/source3/locking/locking_slow.c +++ b/source3/locking/locking_slow.c @@ -188,7 +188,7 @@ static BOOL slow_lock_share_entry(connection_struct *conn, * the open and the lock call. Back out and try again. */ - if(stat(fname, &dummy_stat)!=0) + if(sys_stat(fname, &dummy_stat)!=0) { DEBUG(2,("lock_share_entry: Re-issuing open on %s to fix race. Error was %s\n", fname, strerror(errno))); @@ -232,7 +232,7 @@ static BOOL slow_unlock_share_entry(connection_struct *conn, share_name(conn, dev, inode, fname); /* get the share mode file size */ - if(fstat((int)token, &sb) != 0) + if(sys_fstat((int)token, &sb) != 0) { DEBUG(0,("ERROR: unlock_share_entry: Failed to do stat on share file %s (%s)\n", fname, strerror(errno))); @@ -269,12 +269,12 @@ static int read_share_file(connection_struct *conn, int fd, char *fname, char ** { SMB_STRUCT_STAT sb; char *buf; - int size; + SMB_OFF_T size; *out = 0; *p_new_file = False; - if(fstat(fd, &sb) != 0) + if(sys_fstat(fd, &sb) != 0) { DEBUG(0,("ERROR: read_share_file: Failed to do stat on share file %s (%s)\n", fname, strerror(errno))); @@ -288,14 +288,14 @@ static int read_share_file(connection_struct *conn, int fd, char *fname, char ** } /* Allocate space for the file */ - if((buf = (char *)malloc(sb.st_size)) == NULL) + if((buf = (char *)malloc((size_t)sb.st_size)) == NULL) { DEBUG(0,("read_share_file: malloc for file size %d fail !\n", (int)sb.st_size)); return -1; } - if(lseek(fd, 0, SEEK_SET) != 0) + if(sys_lseek(fd, (SMB_OFF_T)0, SEEK_SET) != 0) { DEBUG(0,("ERROR: read_share_file: Failed to reset position to 0 \ for share file %s (%s)\n", fname, strerror(errno))); @@ -304,7 +304,7 @@ for share file %s (%s)\n", fname, strerror(errno))); return -1; } - if (read(fd,buf,sb.st_size) != sb.st_size) + if (read(fd,buf,(size_t)sb.st_size) != (size_t)sb.st_size) { DEBUG(0,("ERROR: read_share_file: Failed to read share file %s (%s)\n", fname, strerror(errno))); @@ -472,7 +472,7 @@ it left a share mode entry with mode 0x%X in share file %s\n", if(num_entries_copied != num_entries) { - if(lseek(fd, 0, SEEK_SET) != 0) + if(sys_lseek(fd, (SMB_OFF_T)0, SEEK_SET) != 0) { DEBUG(0,("ERROR: get_share_modes: lseek failed to reset to \ position 0 for share mode file %s (%s)\n", fname, strerror(errno))); @@ -510,7 +510,7 @@ mode file %s (%s)\n", fname, strerror(errno))); return 0; } /* Now truncate the file at this point. */ - if(ftruncate(fd, newsize)!= 0) + if(sys_ftruncate(fd, (SMB_OFF_T)newsize)!= 0) { DEBUG(0,("ERROR: get_share_modes: failed to ftruncate share \ mode file %s to size %d (%s)\n", fname, newsize, strerror(errno))); @@ -642,7 +642,7 @@ for share file %s\n", num_entries, fname)); } /* Re-write the file - and truncate it at the correct point. */ - if(lseek(fd, 0, SEEK_SET) != 0) + if(sys_lseek(fd, (SMB_OFF_T)0, SEEK_SET) != 0) { DEBUG(0,("ERROR: del_share_mode: lseek failed to reset to \ position 0 for share mode file %s (%s)\n", fname, strerror(errno))); @@ -662,7 +662,7 @@ mode file %s (%s)\n", fname, strerror(errno))); } /* Now truncate the file at this point. */ - if(ftruncate(fd, newsize) != 0) + if(sys_ftruncate(fd, (SMB_OFF_T)newsize) != 0) { DEBUG(0,("ERROR: del_share_mode: failed to ftruncate share \ mode file %s to size %d (%s)\n", fname, newsize, strerror(errno))); @@ -689,7 +689,7 @@ static BOOL slow_set_share_mode(int token,files_struct *fsp, uint16 port, uint16 share_name(fsp->conn, fsp->fd_ptr->dev, fsp->fd_ptr->inode, fname); - if(fstat(fd, &sb) != 0) + if(sys_fstat(fd, &sb) != 0) { DEBUG(0,("ERROR: set_share_mode: Failed to do stat on share file %s\n", fname)); @@ -699,17 +699,17 @@ static BOOL slow_set_share_mode(int token,files_struct *fsp, uint16 port, uint16 /* Sanity check for file contents (if it's not a new share file). */ if(sb.st_size != 0) { - int size = sb.st_size; + SMB_OFF_T size = sb.st_size; /* Allocate space for the file plus one extra entry */ - if((buf = (char *)malloc(sb.st_size + SMF_ENTRY_LENGTH)) == NULL) + if((buf = (char *)malloc((size_t)(sb.st_size + SMF_ENTRY_LENGTH))) == NULL) { DEBUG(0,("set_share_mode: malloc for file size %d fail !\n", (int)(sb.st_size + SMF_ENTRY_LENGTH))); return False; } - if(lseek(fd, 0, SEEK_SET) != 0) + if(sys_lseek(fd, (SMB_OFF_T)0, SEEK_SET) != 0) { DEBUG(0,("ERROR: set_share_mode: Failed to reset position \ to 0 for share file %s (%s)\n", fname, strerror(errno))); @@ -718,7 +718,7 @@ to 0 for share file %s (%s)\n", fname, strerror(errno))); return False; } - if (read(fd,buf,sb.st_size) != sb.st_size) + if (read(fd,buf,(size_t)sb.st_size) != (size_t)sb.st_size) { DEBUG(0,("ERROR: set_share_mode: Failed to read share file %s (%s)\n", fname, strerror(errno))); @@ -781,7 +781,7 @@ deleting it.\n", fname)); SIVAL(buf,SMF_NUM_ENTRIES_OFFSET,num_entries); - if(lseek(fd, 0, SEEK_SET) != 0) + if(sys_lseek(fd, (SMB_OFF_T)0, SEEK_SET) != 0) { DEBUG(0,("ERROR: set_share_mode: (1) Failed to reset position to \ 0 for share file %s (%s)\n", fname, strerror(errno))); @@ -803,7 +803,7 @@ deleting it (%s).\n",fname, strerror(errno))); /* Now truncate the file at this point - just for safety. */ - if(ftruncate(fd, header_size + (SMF_ENTRY_LENGTH*num_entries))!= 0) + if(sys_ftruncate(fd, (SMB_OFF_T)(header_size + (SMF_ENTRY_LENGTH*num_entries)))!= 0) { DEBUG(0,("ERROR: set_share_mode: failed to ftruncate share \ mode file %s to size %d (%s)\n", fname, header_size + (SMF_ENTRY_LENGTH*num_entries), @@ -916,7 +916,7 @@ from the share file %s\n", i, num_entries, fname)); } /* Re-write the file - and truncate it at the correct point. */ - if(lseek(fd, 0, SEEK_SET) != 0) + if(sys_lseek(fd, (SMB_OFF_T)0, SEEK_SET) != 0) { DEBUG(0,("ERROR: remove_share_oplock: lseek failed to reset to \ position 0 for share mode file %s (%s)\n", fname, strerror(errno))); |