mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-22 04:41:21 +03:00
Not using $HOME when we're root, because some sudos don't filter it out
of the environment (which can lead to a root-owned .nano/ directory in the invoking user's home directory). This addresses Ubuntu bug #1471459. (See https://bugs.launchpad.net/ubuntu/+source/nano/+bug/1471459.) git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5580 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
parent
0af2f9e55c
commit
3a3b1764af
@ -1,3 +1,9 @@
|
|||||||
|
2016-01-22 Benno Schulenberg <bensberg@justemail.net>
|
||||||
|
* src/utils.c (get_homedir): Don't use $HOME when we're root, because
|
||||||
|
some sudos don't filter it out of the environment (which can lead to
|
||||||
|
a root-owned .nano/ directory in the invoking user's home directory).
|
||||||
|
It fixes https://bugs.launchpad.net/ubuntu/+source/nano/+bug/1471459.
|
||||||
|
|
||||||
2016-01-21 Benno Schulenberg <bensberg@justemail.net>
|
2016-01-21 Benno Schulenberg <bensberg@justemail.net>
|
||||||
* src/prompt.c (get_prompt_string): Preserve the cursor position on
|
* src/prompt.c (get_prompt_string): Preserve the cursor position on
|
||||||
the statusbar when just toggling a setting or making an excursion to
|
the statusbar when just toggling a setting or making an excursion to
|
||||||
|
@ -37,7 +37,9 @@ void get_homedir(void)
|
|||||||
if (homedir == NULL) {
|
if (homedir == NULL) {
|
||||||
const char *homenv = getenv("HOME");
|
const char *homenv = getenv("HOME");
|
||||||
|
|
||||||
if (homenv == NULL) {
|
/* When HOME isn't set, or when we're root, get the home directory
|
||||||
|
* from the password file instead. */
|
||||||
|
if (homenv == NULL || geteuid() == 0) {
|
||||||
const struct passwd *userage = getpwuid(geteuid());
|
const struct passwd *userage = getpwuid(geteuid());
|
||||||
|
|
||||||
if (userage != NULL)
|
if (userage != NULL)
|
||||||
|
Loading…
Reference in New Issue
Block a user