Changs to die() and handle_sighup() for security
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@358 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
9e2934fd27
commit
e7a5893245
|
@ -57,6 +57,12 @@ CVS code -
|
||||||
- Update the previous line as well as the current one in case we
|
- Update the previous line as well as the current one in case we
|
||||||
have moved beyond COLS or back from COLS, patch submitted
|
have moved beyond COLS or back from COLS, patch submitted
|
||||||
by Ryan Krebs.
|
by Ryan Krebs.
|
||||||
|
die()
|
||||||
|
- Now creates .save file using variable-length strings. Also
|
||||||
|
calls write_file with tmp == 1, which happens to do exactly what
|
||||||
|
we want (ignore symlinks and use mode 0600).
|
||||||
|
handle_sighup()
|
||||||
|
- Now calls die instead of writing on its own and exiting normally.
|
||||||
- search.c:
|
- search.c:
|
||||||
do_replace_hilight()
|
do_replace_hilight()
|
||||||
- New function, displays the currently selected word as hilighted
|
- New function, displays the currently selected word as hilighted
|
||||||
|
|
14
nano.c
14
nano.c
|
@ -112,12 +112,13 @@ void die(char *msg, ...)
|
||||||
/* if we can't save we have REAL bad problems,
|
/* if we can't save we have REAL bad problems,
|
||||||
* but we might as well TRY. */
|
* but we might as well TRY. */
|
||||||
if (filename[0] == '\0') {
|
if (filename[0] == '\0') {
|
||||||
write_file("nano.save", 0);
|
write_file("nano.save", 1);
|
||||||
} else {
|
} else {
|
||||||
char buf[BUFSIZ];
|
|
||||||
strncpy(buf, filename, BUFSIZ);
|
char *buf = nmalloc(strlen(filename) + 6);
|
||||||
strncat(buf, ".save", BUFSIZ - strlen(buf));
|
strcpy(buf, filename);
|
||||||
write_file(buf, 0);
|
strcat(buf, ".save");
|
||||||
|
write_file(buf, 1);
|
||||||
}
|
}
|
||||||
/* Restore the old term settings */
|
/* Restore the old term settings */
|
||||||
tcsetattr(0, TCSANOW, &oldterm);
|
tcsetattr(0, TCSANOW, &oldterm);
|
||||||
|
@ -1489,8 +1490,7 @@ void do_mouse(void)
|
||||||
/* Handler for SIGHUP */
|
/* Handler for SIGHUP */
|
||||||
RETSIGTYPE handle_hup(int signal)
|
RETSIGTYPE handle_hup(int signal)
|
||||||
{
|
{
|
||||||
write_file("nano.save", 0);
|
die(_("Received SIGHUP"));
|
||||||
finish(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* What do we do when we catch the suspend signal */
|
/* What do we do when we catch the suspend signal */
|
||||||
|
|
124
po/nano.pot
124
po/nano.pot
|
@ -6,7 +6,7 @@
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"POT-Creation-Date: 2000-12-01 18:47-0500\n"
|
"POT-Creation-Date: 2000-12-01 21:30-0500\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
@ -55,7 +55,7 @@ msgstr ""
|
||||||
msgid "File to insert [from ./] "
|
msgid "File to insert [from ./] "
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: files.c:284 files.c:309 files.c:517 nano.c:1409
|
#: files.c:284 files.c:309 files.c:517 nano.c:1410
|
||||||
msgid "Cancelled"
|
msgid "Cancelled"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -400,17 +400,17 @@ msgstr ""
|
||||||
msgid "No Replace"
|
msgid "No Replace"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:131
|
#: nano.c:132
|
||||||
msgid ""
|
msgid ""
|
||||||
"\n"
|
"\n"
|
||||||
"Buffer written to 'nano.save'\n"
|
"Buffer written to 'nano.save'\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:138
|
#: nano.c:139
|
||||||
msgid "Key illegal in VIEW mode"
|
msgid "Key illegal in VIEW mode"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:175
|
#: nano.c:176
|
||||||
msgid ""
|
msgid ""
|
||||||
" nano help text\n"
|
" nano help text\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
@ -431,238 +431,242 @@ msgid ""
|
||||||
"\n"
|
"\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:278
|
#: nano.c:279
|
||||||
msgid "free_node(): free'd a node, YAY!\n"
|
msgid "free_node(): free'd a node, YAY!\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:283
|
#: nano.c:284
|
||||||
msgid "free_node(): free'd last node.\n"
|
msgid "free_node(): free'd last node.\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:335
|
#: nano.c:336
|
||||||
msgid ""
|
msgid ""
|
||||||
"Usage: nano [GNU long option] [option] +LINE <file>\n"
|
"Usage: nano [GNU long option] [option] +LINE <file>\n"
|
||||||
"\n"
|
"\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:336
|
#: nano.c:337
|
||||||
msgid "Option\t\tLong option\t\tMeaning\n"
|
msgid "Option\t\tLong option\t\tMeaning\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:338
|
#: nano.c:339
|
||||||
msgid " -T \t\t--tabsize=[num]\t\tSet width of a tab to num\n"
|
msgid " -T \t\t--tabsize=[num]\t\tSet width of a tab to num\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:341
|
#: nano.c:342
|
||||||
msgid " -R\t\t--regexp\t\tUse regular expressions for search\n"
|
msgid " -R\t\t--regexp\t\tUse regular expressions for search\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:345
|
#: nano.c:346
|
||||||
msgid " -V \t\t--version\t\tPrint version information and exit\n"
|
msgid " -V \t\t--version\t\tPrint version information and exit\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:347
|
#: nano.c:348
|
||||||
msgid " -c \t\t--const\t\t\tConstantly show cursor position\n"
|
msgid " -c \t\t--const\t\t\tConstantly show cursor position\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:349
|
#: nano.c:350
|
||||||
msgid " -h \t\t--help\t\t\tShow this message\n"
|
msgid " -h \t\t--help\t\t\tShow this message\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:352
|
#: nano.c:353
|
||||||
msgid " -k \t\t--cut\t\t\tLet ^K cut from cursor to end of line\n"
|
msgid " -k \t\t--cut\t\t\tLet ^K cut from cursor to end of line\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:355
|
#: nano.c:356
|
||||||
msgid " -i \t\t--autoindent\t\tAutomatically indent new lines\n"
|
msgid " -i \t\t--autoindent\t\tAutomatically indent new lines\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:357
|
#: nano.c:358
|
||||||
msgid " -l \t\t--nofollow\t\tDon't follow symbolic links, overwrite\n"
|
msgid " -l \t\t--nofollow\t\tDon't follow symbolic links, overwrite\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:360
|
#: nano.c:361
|
||||||
msgid " -m \t\t--mouse\t\t\tEnable mouse\n"
|
msgid " -m \t\t--mouse\t\t\tEnable mouse\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:365
|
#: nano.c:366
|
||||||
msgid ""
|
msgid ""
|
||||||
" -r [#cols] \t--fill=[#cols]\t\tSet fill cols to (wrap lines at) #cols\n"
|
" -r [#cols] \t--fill=[#cols]\t\tSet fill cols to (wrap lines at) #cols\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:367
|
#: nano.c:368
|
||||||
msgid " -p\t \t--pico\t\t\tEmulate Pico as closely as possible\n"
|
msgid " -p\t \t--pico\t\t\tEmulate Pico as closely as possible\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:369
|
#: nano.c:370
|
||||||
msgid " -s [prog] \t--speller=[prog]\tEnable alternate speller\n"
|
msgid " -s [prog] \t--speller=[prog]\tEnable alternate speller\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:371
|
#: nano.c:372
|
||||||
msgid " -t \t\t--tempfile\t\tAuto save on exit, don't prompt\n"
|
msgid " -t \t\t--tempfile\t\tAuto save on exit, don't prompt\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:373
|
#: nano.c:374
|
||||||
msgid " -v \t\t--view\t\t\tView (read only) mode\n"
|
msgid " -v \t\t--view\t\t\tView (read only) mode\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:375
|
#: nano.c:376
|
||||||
msgid " -w \t\t--nowrap\t\tDon't wrap long lines\n"
|
msgid " -w \t\t--nowrap\t\tDon't wrap long lines\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:377
|
#: nano.c:378
|
||||||
msgid " -x \t\t--nohelp\t\tDon't show help window\n"
|
msgid " -x \t\t--nohelp\t\tDon't show help window\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:379
|
#: nano.c:380
|
||||||
msgid " -z \t\t--suspend\t\tEnable suspend\n"
|
msgid " -z \t\t--suspend\t\tEnable suspend\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:381
|
#: nano.c:382
|
||||||
msgid " +LINE\t\t\t\t\tStart at line number LINE\n"
|
msgid " +LINE\t\t\t\t\tStart at line number LINE\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:383
|
#: nano.c:384
|
||||||
msgid ""
|
msgid ""
|
||||||
"Usage: nano [option] +LINE <file>\n"
|
"Usage: nano [option] +LINE <file>\n"
|
||||||
"\n"
|
"\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:384
|
#: nano.c:385
|
||||||
msgid "Option\t\tMeaning\n"
|
msgid "Option\t\tMeaning\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:385
|
#: nano.c:386
|
||||||
msgid " -T [num]\tSet width of a tab to num\n"
|
msgid " -T [num]\tSet width of a tab to num\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:386
|
#: nano.c:387
|
||||||
msgid " -R\t\tUse regular expressions for search\n"
|
msgid " -R\t\tUse regular expressions for search\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:387
|
#: nano.c:388
|
||||||
msgid " -V \t\tPrint version information and exit\n"
|
msgid " -V \t\tPrint version information and exit\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:388
|
#: nano.c:389
|
||||||
msgid " -c \t\tConstantly show cursor position\n"
|
msgid " -c \t\tConstantly show cursor position\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:389
|
#: nano.c:390
|
||||||
msgid " -h \t\tShow this message\n"
|
msgid " -h \t\tShow this message\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:391
|
#: nano.c:392
|
||||||
msgid " -k \t\tLet ^K cut from cursor to end of line\n"
|
msgid " -k \t\tLet ^K cut from cursor to end of line\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:393
|
#: nano.c:394
|
||||||
msgid " -i \t\tAutomatically indent new lines\n"
|
msgid " -i \t\tAutomatically indent new lines\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:395
|
#: nano.c:396
|
||||||
msgid " -l \t\tDon't follow symbolic links, overwrite\n"
|
msgid " -l \t\tDon't follow symbolic links, overwrite\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:398
|
#: nano.c:399
|
||||||
msgid " -m \t\tEnable mouse\n"
|
msgid " -m \t\tEnable mouse\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:402
|
#: nano.c:403
|
||||||
msgid " -r [#cols] \tSet fill cols to (wrap lines at) #cols\n"
|
msgid " -r [#cols] \tSet fill cols to (wrap lines at) #cols\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:403
|
#: nano.c:404
|
||||||
msgid " -s [prog] \tEnable alternate speller\n"
|
msgid " -s [prog] \tEnable alternate speller\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:404
|
#: nano.c:405
|
||||||
msgid " -p \t\tEmulate Pico as closely as possible\n"
|
msgid " -p \t\tEmulate Pico as closely as possible\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:405
|
#: nano.c:406
|
||||||
msgid " -t \t\tAuto save on exit, don't prompt\n"
|
msgid " -t \t\tAuto save on exit, don't prompt\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:406
|
#: nano.c:407
|
||||||
msgid " -v \t\tView (read only) mode\n"
|
msgid " -v \t\tView (read only) mode\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:407
|
#: nano.c:408
|
||||||
msgid " -w \t\tDon't wrap long lines\n"
|
msgid " -w \t\tDon't wrap long lines\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:408
|
#: nano.c:409
|
||||||
msgid " -x \t\tDon't show help window\n"
|
msgid " -x \t\tDon't show help window\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:409
|
#: nano.c:410
|
||||||
msgid " -z \t\tEnable suspend\n"
|
msgid " -z \t\tEnable suspend\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:410
|
#: nano.c:411
|
||||||
msgid " +LINE\t\tStart at line number LINE\n"
|
msgid " +LINE\t\tStart at line number LINE\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:417
|
#: nano.c:418
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid " nano version %s by Chris Allegretta (compiled %s, %s)\n"
|
msgid " nano version %s by Chris Allegretta (compiled %s, %s)\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:420
|
#: nano.c:421
|
||||||
msgid " Email: nano@nano-editor.org\tWeb: http://www.nano-editor.org"
|
msgid " Email: nano@nano-editor.org\tWeb: http://www.nano-editor.org"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:421
|
#: nano.c:422
|
||||||
msgid ""
|
msgid ""
|
||||||
"\n"
|
"\n"
|
||||||
" Compiled options:"
|
" Compiled options:"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:477
|
#: nano.c:478
|
||||||
msgid "Mark Set"
|
msgid "Mark Set"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:482
|
#: nano.c:483
|
||||||
msgid "Mark UNset"
|
msgid "Mark UNset"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:930
|
#: nano.c:931
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "check_wrap called with inptr->data=\"%s\"\n"
|
msgid "check_wrap called with inptr->data=\"%s\"\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:981
|
#: nano.c:982
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "current->data now = \"%s\"\n"
|
msgid "current->data now = \"%s\"\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:1034
|
#: nano.c:1035
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "After, data = \"%s\"\n"
|
msgid "After, data = \"%s\"\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:1134
|
#: nano.c:1135
|
||||||
msgid "Edit a replacement"
|
msgid "Edit a replacement"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:1358
|
#: nano.c:1359
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Could not create a temporary filename: %s"
|
msgid "Could not create a temporary filename: %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:1374
|
#: nano.c:1375
|
||||||
msgid "Finished checking spelling"
|
msgid "Finished checking spelling"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:1376
|
#: nano.c:1377
|
||||||
msgid "Spell checking failed"
|
msgid "Spell checking failed"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:1396
|
#: nano.c:1397
|
||||||
msgid "Save modified buffer (ANSWERING \"No\" WILL DESTROY CHANGES) ? "
|
msgid "Save modified buffer (ANSWERING \"No\" WILL DESTROY CHANGES) ? "
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: nano.c:1493
|
||||||
|
msgid "Received SIGHUP"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: nano.c:1559
|
#: nano.c:1559
|
||||||
msgid "Cannot resize top win"
|
msgid "Cannot resize top win"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
Loading…
Reference in New Issue