From: Volker Lendecke Date: Wed, 24 Jul 2019 13:48:50 +0000 (+0200) Subject: smbd: FTRUNCATE regular files only X-Git-Tag: tdb-1.4.2~181 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=16b56549d2ca6aad68467116ca08829c1144a41b;p=thirdparty%2Fsamba.git 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 Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/open.c b/source3/smbd/open.c index d07bebc376d..faba16a7fef 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -3514,7 +3514,7 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn, /* Should we atomically (to the client at least) truncate ? */ if ((!new_file_created) && (flags2 & O_TRUNC) && - (!S_ISFIFO(fsp->fsp_name->st.st_ex_mode))) { + (S_ISREG(fsp->fsp_name->st.st_ex_mode))) { int ret; ret = SMB_VFS_FTRUNCATE(fsp, 0);