diff --git a/ChangeLog b/ChangeLog index d78ec880..ddb116ca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -208,8 +208,12 @@ CVS code - after the terminal is properly set up, so that we can restore it easily after a resize. (DLR) - Add missing cast to char when calling do_char(). (DLR) + - Don't initialize the backup directory if we're in restricted + mode, since backups are disabled then. (DLR) - Check $SPELL for an alternative spell checker if we didn't get - one from the command line and/or rcfile, as Pico does. (DLR) + one from the command line and/or rcfile, as Pico does. Don't + do this if we're in restricted mode, since spell checking is + disabled then. (DLR) - nano.h: - Since REGEXP_COMPILED is only used in search.c, convert it from a flag to a static int there. (DLR) diff --git a/src/nano.c b/src/nano.c index 1aebe419..3109bacb 100644 --- a/src/nano.c +++ b/src/nano.c @@ -3367,14 +3367,17 @@ int main(int argc, char *argv[]) #endif #ifndef NANO_SMALL - /* Set up the backup directory. This entails making sure it exists - * and is a directory, so that backup files will be saved there. */ - init_backup_dir(); + /* Set up the backup directory (unless we're using restricted mode, + * in which case backups are disabled). This entails making sure it + * exists and is a directory, so that backup files will be saved + * there. */ + if (!ISSET(RESTRICTED)) + init_backup_dir(); #endif #ifndef DISABLE_OPERATINGDIR /* Set up the operating directory. This entails chdir()ing there, - so that file reads and writes will be based there. */ + * so that file reads and writes will be based there. */ init_operating_dir(); #endif @@ -3390,8 +3393,9 @@ int main(int argc, char *argv[]) #ifndef DISABLE_SPELLER /* If we don't have an alternative spell checker after reading the * command line and/or rcfile, check $SPELL for one, as Pico - * does. */ - if (alt_speller == NULL) { + * does (unless we're using restricted mode, in which case spell + * checking is disabled). */ + if (!ISSET(RESTRICTED) && alt_speller == NULL) { char *spellenv = getenv("SPELL"); if (spellenv != NULL) alt_speller = mallocstrcpy(NULL, spellenv);