1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-03 04:22:09 +03:00

Fix lseek-on-pipe problem in VFS (where it belongs IMHO).

Jeremy.
This commit is contained in:
Jeremy Allison
-
parent 0242d0e178
commit ebef2e7bc8
2 changed files with 19 additions and 18 deletions

View File

@ -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;

View File

@ -230,6 +230,19 @@ SMB_OFF_T vfswrap_lseek(files_struct *fsp, int filedes, SMB_OFF_T offset, int wh
START_PROFILE(syscall_lseek);
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;
}