summaryrefslogtreecommitdiff
path: root/source3/lib/util.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2000-11-16 00:59:18 +0000
committerJeremy Allison <jra@samba.org>2000-11-16 00:59:18 +0000
commit6f58dd587124c8b85fc62177b26129aaea5819b0 (patch)
tree40c926a6f3e5b5db7e913e13ea6571b97dacf362 /source3/lib/util.c
parent14355a6434952071e862af3a1e7bcfbbf640a6a3 (diff)
downloadsamba-6f58dd587124c8b85fc62177b26129aaea5819b0.tar.gz
samba-6f58dd587124c8b85fc62177b26129aaea5819b0.tar.bz2
samba-6f58dd587124c8b85fc62177b26129aaea5819b0.zip
Ok - fixed a bug in our levelII oplock code. We need to break a level II on
a byte range lock (write lock only, but Win2k breaks on read lock also so I do the same) - if you think about why, this is obvious. Also fixed our client code to do level II oplocks, if requested, and fixed the code where we would assume the client wanted level II if it advertised itself as being level II capable - it may not want that. Jeremy. (This used to be commit 213cd0b5192307cd4b0026cae94b2f52fb1b0c02)
Diffstat (limited to 'source3/lib/util.c')
-rw-r--r--source3/lib/util.c51
1 files changed, 0 insertions, 51 deletions
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 0aef60082f..2d922aab70 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -649,57 +649,6 @@ BOOL yesno(char *p)
return(False);
}
-/****************************************************************************
-set the length of a file from a filedescriptor.
-Returns 0 on success, -1 on failure.
-****************************************************************************/
-
-/* tpot vfs need to recode this function */
-
-int set_filelen(int fd, SMB_OFF_T len)
-{
-/* According to W. R. Stevens advanced UNIX prog. Pure 4.3 BSD cannot
- extend a file with ftruncate. Provide alternate implementation
- for this */
-
-#ifdef HAVE_FTRUNCATE_EXTEND
- return sys_ftruncate(fd, len);
-#else
- SMB_STRUCT_STAT st;
- char c = 0;
- SMB_OFF_T currpos = sys_lseek(fd, (SMB_OFF_T)0, SEEK_CUR);
-
- if(currpos == -1)
- return -1;
- /* Do an fstat to see if the file is longer than
- the requested size (call ftruncate),
- or shorter, in which case seek to len - 1 and write 1
- byte of zero */
- if(sys_fstat(fd, &st)<0)
- return -1;
-
-#ifdef S_ISFIFO
- if (S_ISFIFO(st.st_mode))
- return 0;
-#endif
-
- if(st.st_size == len)
- return 0;
- if(st.st_size > len)
- return sys_ftruncate(fd, len);
-
- if(sys_lseek(fd, len-1, SEEK_SET) != len -1)
- return -1;
- if(write(fd, &c, 1)!=1)
- return -1;
- /* Seek to where we were */
- if(sys_lseek(fd, currpos, SEEK_SET) != currpos)
- return -1;
- return 0;
-#endif
-}
-
-
#ifdef HPUX
/****************************************************************************
this is a version of setbuffer() for those machines that only have setvbuf