summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-03-02 00:44:38 +0000
committerJeremy Allison <jra@samba.org>2002-03-02 00:44:38 +0000
commit0bc19c0bdbcfac2cad9029bcf36d3d00d82a074b (patch)
tree6a324a61c58939e81e70e41b8bccc367feee8e3a
parenta07e040c8c8515d0ffc2a6cce31a4f0124e42023 (diff)
downloadsamba-0bc19c0bdbcfac2cad9029bcf36d3d00d82a074b.tar.gz
samba-0bc19c0bdbcfac2cad9029bcf36d3d00d82a074b.tar.bz2
samba-0bc19c0bdbcfac2cad9029bcf36d3d00d82a074b.zip
Fix lseek-on-pipe problem in VFS (where it belongs IMHO).
Jeremy. (This used to be commit ebef2e7bc87fcbae794426c39044a7d23f43722d)
-rw-r--r--source3/smbd/fileio.c14
-rw-r--r--source3/smbd/vfs-wrap.c23
2 files changed, 19 insertions, 18 deletions
diff --git a/source3/smbd/fileio.c b/source3/smbd/fileio.c
index 2aafd14c99..acbbb73352 100644
--- a/source3/smbd/fileio.c
+++ b/source3/smbd/fileio.c
@@ -36,19 +36,7 @@ SMB_OFF_T seek_file(files_struct *fsp,SMB_OFF_T pos)
seek_ret = fsp->conn->vfs_ops.lseek(fsp,fsp->fd,pos+offset,SEEK_SET);
- /*
- * We want to maintain the fiction that we can seek
- * on a fifo for file system purposes. This allows
- * people to set up UNIX fifo's that feed data to Windows
- * applications. JRA.
- */
-
- if((seek_ret == -1) && (errno == ESPIPE)) {
- seek_ret = pos+offset;
- errno = 0;
- }
-
- if((seek_ret == -1) || (seek_ret != pos+offset)) {
+ if(seek_ret == -1) {
DEBUG(0,("seek_file: sys_lseek failed. Error was %s\n", strerror(errno) ));
fsp->pos = -1;
return -1;
diff --git a/source3/smbd/vfs-wrap.c b/source3/smbd/vfs-wrap.c
index 15d9572d1d..bb7d497274 100644
--- a/source3/smbd/vfs-wrap.c
+++ b/source3/smbd/vfs-wrap.c
@@ -225,13 +225,26 @@ ssize_t vfswrap_write(files_struct *fsp, int fd, const void *data, size_t n)
SMB_OFF_T vfswrap_lseek(files_struct *fsp, int filedes, SMB_OFF_T offset, int whence)
{
- SMB_OFF_T result;
+ SMB_OFF_T result;
- START_PROFILE(syscall_lseek);
+ START_PROFILE(syscall_lseek);
- result = sys_lseek(filedes, offset, whence);
- END_PROFILE(syscall_lseek);
- return result;
+ result = sys_lseek(filedes, offset, whence);
+
+ /*
+ * We want to maintain the fiction that we can seek
+ * on a fifo for file system purposes. This allows
+ * people to set up UNIX fifo's that feed data to Windows
+ * applications. JRA.
+ */
+
+ if((result == -1) && (errno == ESPIPE)) {
+ result = 0;
+ errno = 0;
+ }
+
+ END_PROFILE(syscall_lseek);
+ return result;
}
int vfswrap_rename(connection_struct *conn, const char *old, const char *new)