From 86f4384b9133c975495cf027d55d5a5c1320e03c Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Mon, 7 Apr 2014 18:34:10 +0000 Subject: [PATCH] Turn wrapping off when --disable-wrapping-as-root was used, no matter what. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4742 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 3 +++ src/nano.c | 12 +++--------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4cfd46ab..9001f04c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,9 @@ * src/{proto.h,files.c,global.c,nano.c,rcfile.c}: Drop the obsolete argument of shortcut_init(), and remove two unneeded calls of it. * src/global.c (shortcut_init): Allow M-J after an --enable-justify. + * src/nano.c (main): No matter whether nanorc support was disabled + or not, or the rcfile should be ignored or not, when we're root and + --disable-wrapping-as-root was used, switch wrapping off. 2014-04-06 Benno Schulenberg * src/global.c (shortcut_init): Limit M-T (cut-till-end-of-file) to diff --git a/src/nano.c b/src/nano.c index de3b5c81..080abedc 100644 --- a/src/nano.c +++ b/src/nano.c @@ -2184,9 +2184,9 @@ int main(int argc, char **argv) textdomain(PACKAGE); #endif -#if !defined(ENABLE_NANORC) && defined(DISABLE_ROOTWRAPPING) - /* If we don't have rcfile support, --disable-wrapping-as-root is - * used, and we're root, turn wrapping off. */ +#ifdef DISABLE_ROOTWRAPPING + /* If --disable-wrapping-as-root was used, + * and we're root, turn wrapping off. */ if (geteuid() == NANO_ROOT_UID) SET(NO_WRAP); #endif @@ -2487,12 +2487,6 @@ int main(int argc, char **argv) for (i = 0; i < sizeof(flags) / sizeof(flags[0]); i++) flags[i] |= flags_cpy[i]; } -#ifdef DISABLE_ROOTWRAPPING - /* If we don't have any rcfiles, --disable-wrapping-as-root is used, - * and we're root, turn wrapping off. */ - else if (geteuid() == NANO_ROOT_UID) - SET(NO_WRAP); -#endif #endif /* ENABLE_NANORC */ #ifndef DISABLE_WRAPPING -- 2.39.5