mirror of
https://github.com/MidnightCommander/mc
synced 2025-02-22 10:14:14 +03:00
smbfs.c (smbfs_open_readwrite): Implement O_APPEND via smbfs_lseek().
This commit is contained in:
parent
7680fd6884
commit
81e4bdfe72
@ -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.
|
||||
|
12
vfs/smbfs.c
12
vfs/smbfs.c
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user