]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: if close fails just log it, don't crash
authorRalph Boehme <slow@samba.org>
Thu, 7 Jul 2022 12:40:28 +0000 (14:40 +0200)
committerVolker Lendecke <vl@samba.org>
Fri, 8 Jul 2022 09:04:28 +0000 (09:04 +0000)
Originally I added the assert here as we can't return the error being in a
talloc destructor. But OEMs prefer error log messages over crashes.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Jul  8 09:04:28 UTC 2022 on sn-devel-184

source3/smbd/files.c

index f4737278dd0986dfb10c884b9cb175a8fbb00518..45cc7ffd79fb1779322ce6c0d0aac8e3c2949311 100644 (file)
@@ -424,12 +424,20 @@ static int smb_fname_fsp_destructor(struct smb_filename *smb_fname)
                fsp_set_base_fsp(fsp, NULL);
 
                status = fd_close(tmp_base_fsp);
-               SMB_ASSERT(NT_STATUS_IS_OK(status));
+               if (NT_STATUS_IS_OK(status)) {
+                       DBG_ERR("Closing fd for fsp [%s] failed: %s. "
+                               "Please check your filesystem!!!\n",
+                               fsp_str_dbg(fsp), nt_errstr(status));
+               }
                file_free(NULL, tmp_base_fsp);
        }
 
        status = fd_close(fsp);
-       SMB_ASSERT(NT_STATUS_IS_OK(status));
+       if (NT_STATUS_IS_OK(status)) {
+               DBG_ERR("Closing fd for fsp [%s] failed: %s. "
+                       "Please check your filesystem!!!\n",
+                       fsp_str_dbg(fsp), nt_errstr(status));
+       }
        file_free(NULL, fsp);
        smb_fname->fsp = NULL;