mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-25 22:29:42 +03:00
files: warn the root user when all the write bits are missing
Root has carte blanche to both read unreadable files and write unwritable files -- the file system does not prevent this. So, alert root when opening a file that is intended to be read-only. This fulfills https://savannah.gnu.org/bugs/?58685. Requested-by: Marius Bakke <mbakke@fastmail.com>
This commit is contained in:
parent
d18cfb26cd
commit
180a53cc0c
@ -401,6 +401,10 @@ bool open_buffer(const char *filename, bool new_one)
|
||||
free(realname);
|
||||
return FALSE;
|
||||
}
|
||||
#else
|
||||
if (new_one && !(fileinfo.st_mode & (S_IWUSR|S_IWGRP|S_IWOTH)) &&
|
||||
geteuid() == ROOT_UID)
|
||||
statusline(ALERT, _("%s is meant to be read-only"), realname);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user