MidnightCommander/mc — pull request #32 by CyberShadow (2014-01-20 03:32:56+00:00)
Title: Several improvements in editor saving behavior

By far the most frustrating thing in Midnight Commander for me was when I accidentally start editing a file in /etc while running mc as non-root, and then end up in a situation where I either have to discard my changes, re-run mc as root, and redo them, or save the file to my home directory and then manually sudo cp it over the destination. This patch solves the problem along with some others:

- OS errors are propagated to the user - editor errors now display `errno` (text and number), like the file manager
- When failing to save the current file, show an error message instead of displaying the "Save as..." dialog
- When failing to save a file (and displaying the reason why), allow the user to select "Save as..." or "Cancel"
- Additionally, if the user is not root, and the file failed to save due to an access or permission error, give the user the option "sudo", which will save the file to `mc_tmpdir` and run `sudo cp ` in the subshell. This allows the user to authenticate themselves to `sudo` and complete the file save.

If there are any issues with the patch, I'll be happy to address them and rebase the pull request.