Open up a blend file that is read-only, make changes, and then try to close it. The Quit Close dialog will ask you if you want to save before closing. But you will briefly see an error message flash before Blender closes without saving your changes.
Clicking that "Save" Button starts a process that will end with a "post_action" that will close blender when it is done. The process calls operator WM_OT_save_mainfile but unfortunately the result of wm_save_as_mainfile_exec() is not examined to see if an error occurred. It could return OPERATOR_FINISHED if everything saved, or OPERATOR_CANCELLED if there is an error, but the post_action is called regardless.
The patch just makes sure to only allow the post_action to be called (closing blender) if the result of WM_OT_save_mainfile is OPERATOR_FINISHED. So if you say "Yes, I want to save" but it is not able to then blender will remain open and you can read the error message explaining what happened. At that point you can "save as" or close without saving.
Following shows how it looks when saving a file that is read-only after this patch is applied:
