smbfs.c (smbfs_open_readwrite): Implement O_APPEND via smbfs_lseek().

This commit is contained in:
Andrew V. Samoilov 2004-08-26 19:51:38 +00:00
parent 7680fd6884
commit 81e4bdfe72
2 changed files with 14 additions and 2 deletions

View File

@ -1,3 +1,7 @@
2004-08-27 Andrew V. Samoilov <sav bcs zp ua>
* smbfs.c (smbfs_open_readwrite): Implement O_APPEND via smbfs_lseek().
2004-08-26 Roland Illig <roland.illig@gmx.de>
* undelfs.c (undelfs_lstat): Adjusted declaration.

View File

@ -1746,8 +1746,10 @@ smbfs_open_readwrite (smbfs_handle *remote_handle, char *rname, int flags, int m
DEBUG (3, ("smbfs_open: O_TRUNC\n"));
remote_handle->fnum =
cli_open (remote_handle->cli, rname, flags & O_CREAT ? flags : O_RDONLY,
DENY_NONE);
cli_open (remote_handle->cli, rname, ((flags & O_CREAT)
|| (flags ==
(O_WRONLY | O_APPEND))) ?
flags : O_RDONLY, DENY_NONE);
if (remote_handle->fnum == -1) {
message (1, MSG_ERROR, _(" %s opening remote file %s "),
@ -1776,6 +1778,12 @@ smbfs_open_readwrite (smbfs_handle *remote_handle, char *rname, int flags, int m
return NULL;
}
if ((flags == (O_WRONLY | O_APPEND)) /* file.c:copy_file_file() -> do_append */
&& smbfs_lseek (remote_handle, 0, SEEK_END) == -1) {
cli_close (remote_handle->cli, remote_handle->fnum);
return NULL;
}
return remote_handle;
}