- rcfile.c:do_rcfile() - Revert (somewhat) previous behavior of looking at /home/chrisa, and only run getpw* if it is NULL. Most *nix programs seem to only care about /home/chrisa, and at the user-level getpw* may not be reliable (and its slower)
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1460 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Этот коммит содержится в:
родитель
65f075d3a1
Коммит
2e39c1c283
@ -62,6 +62,11 @@ CVS code
|
||||
(David Benbennick).
|
||||
colortoint, parse_colors()
|
||||
- Don't add strings with invalid fg colors at all.
|
||||
do_rcfile()
|
||||
- Revert (somewhat) previous behavior of looking at
|
||||
$HOME, and only run getpw* if it is NULL. Most *nix programs
|
||||
seem to only care about $HOME, and at the user-level
|
||||
getpw* may not be reliable (and its slower).
|
||||
- search.c:
|
||||
do_gotoline()
|
||||
- Only goto_abort() if we *didnt* abort the command, making
|
||||
|
29
rcfile.c
29
rcfile.c
@ -635,20 +635,27 @@ void do_rcfile(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Determine home directory using getpwent(), don't rely on $HOME */
|
||||
do {
|
||||
userage = getpwent();
|
||||
} while (userage != NULL && userage->pw_uid != euid);
|
||||
endpwent();
|
||||
|
||||
lineno = 0;
|
||||
|
||||
if (userage == NULL) {
|
||||
rcfile_error(_("I can't find my home directory! Wah!"));
|
||||
SET(NO_RCFILE);
|
||||
/* Rely on $HOME, fall back on getpwuid() */
|
||||
if (getenv("HOME") != NULL) {
|
||||
nanorc = nrealloc(nanorc, strlen(getenv("HOME")) + 10);
|
||||
sprintf(nanorc, "%s/.nanorc", getenv("HOME"));
|
||||
} else {
|
||||
nanorc = nrealloc(nanorc, strlen(userage->pw_dir) + 9);
|
||||
sprintf(nanorc, "%s/.nanorc", userage->pw_dir);
|
||||
userage = getpwuid(euid);
|
||||
endpwent();
|
||||
|
||||
if (userage == NULL) {
|
||||
rcfile_error(_("I can't find my home directory! Wah!"));
|
||||
SET(NO_RCFILE);
|
||||
} else {
|
||||
nanorc = nrealloc(nanorc, strlen(userage->pw_dir) + 9);
|
||||
sprintf(nanorc, "%s/.nanorc", userage->pw_dir);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (!ISSET(NO_RCFILE)) {
|
||||
|
||||
#if defined(DISABLE_ROOTWRAP) && !defined(DISABLE_WRAPPING)
|
||||
/* If we've already read $SYSCONFDIR/nanorc (if it's there), we're
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user