]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: FTRUNCATE regular files only
authorVolker Lendecke <vl@samba.org>
Wed, 24 Jul 2019 13:48:50 +0000 (15:48 +0200)
committerJeremy Allison <jra@samba.org>
Fri, 9 Aug 2019 22:48:46 +0000 (22:48 +0000)
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>
source3/smbd/open.c

index d07bebc376d53a2de8cf0a4ab687f5562f94db2a..faba16a7fef445d75bd6425163c6f876b18eacab 100644 (file)
@@ -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);