1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-28 01:58:17 +03:00

smbd: FTRUNCATE regular files only

I don't really have a test case, but to me a positive test for a
regular file makes more sense here than just ruling out FIFOs. While
we probably only ever hit regular files (or FIFOs), there might be
more that we catch and don't properly handle.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Volker Lendecke 2019-07-24 15:48:50 +02:00 committed by Jeremy Allison
parent 2c20954af5
commit 16b56549d2

View File

@ -3514,7 +3514,7 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
/* Should we atomically (to the client at least) truncate ? */ /* Should we atomically (to the client at least) truncate ? */
if ((!new_file_created) && if ((!new_file_created) &&
(flags2 & O_TRUNC) && (flags2 & O_TRUNC) &&
(!S_ISFIFO(fsp->fsp_name->st.st_ex_mode))) { (S_ISREG(fsp->fsp_name->st.st_ex_mode))) {
int ret; int ret;
ret = SMB_VFS_FTRUNCATE(fsp, 0); ret = SMB_VFS_FTRUNCATE(fsp, 0);