Better fix for bug #29

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@107 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Chris Allegretta 2000-07-14 02:44:02 +00:00
parent 3088555a15
commit a299b039c4
3 changed files with 22 additions and 16 deletions

2
BUGS
View File

@ -45,5 +45,5 @@
- If nano opens a read-only file with the --tempfile option, and a change
is made to the buffer, and a write is attempted, nano will not give you
a dialog about not being able to write the file, and it will not let the
user exit (29, discovered by Joshua Jensen)
user exit (29, discovered by Joshua Jensen) [FIXED mostly]

12
files.c
View File

@ -310,7 +310,7 @@ int write_file(char *name, int tmp)
if ((fd = open(name, O_APPEND, S_IRUSR | S_IWUSR | S_IRGRP |
S_IWGRP | S_IROTH | S_IWOTH)) == -1) {
UNSET(TEMP_OPT);
do_writeout(1);
return do_writeout(1);
}
else
close(fd);
@ -318,6 +318,10 @@ int write_file(char *name, int tmp)
if ((fd = open(name, O_WRONLY | O_CREAT | O_TRUNC,
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH |
S_IWOTH)) == -1) {
if (ISSET(TEMP_OPT)) {
UNSET(TEMP_OPT);
return do_writeout(1);
}
statusbar(_("Could not open file for writing: %s"),
strerror(errno));
return -1;
@ -334,14 +338,16 @@ int write_file(char *name, int tmp)
strcat(buf, name);
strcat(buf, ".XXXXXX");
if ((fd = mkstemp(buf)) == -1) {
if (ISSET(TEMP_OPT)) {
UNSET(TEMP_OPT);
return do_writeout(1);
}
statusbar(_("Could not open file for writing: %s"),
strerror(errno));
return -1;
}
}
dump_buffer(fileage);
while (fileptr != NULL && fileptr->next != NULL) {
/* Next line is so we discount the "magic line" */

View File

@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2000-07-13 21:22-0400\n"
"POT-Creation-Date: 2000-07-13 22:36-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -55,55 +55,55 @@ msgstr ""
msgid "File to insert [from ./] "
msgstr ""
#: files.c:271 files.c:295 files.c:476 nano.c:1141
#: files.c:271 files.c:295 files.c:482 nano.c:1141
msgid "Cancelled"
msgstr ""
#: files.c:321 files.c:337 files.c:352 files.c:369 files.c:375
#: files.c:325 files.c:345 files.c:358 files.c:375 files.c:381
#, c-format
msgid "Could not open file for writing: %s"
msgstr ""
#: files.c:329
#: files.c:333
msgid "Could not open file: Path length exceeded."
msgstr ""
#: files.c:357
#: files.c:363
#, c-format
msgid "Wrote >%s\n"
msgstr ""
#: files.c:384
#: files.c:390
#, c-format
msgid "Could not close %s: %s"
msgstr ""
#. Try a rename??
#: files.c:405 files.c:416 files.c:421
#: files.c:411 files.c:422 files.c:427
#, c-format
msgid "Could not open %s for writing: %s"
msgstr ""
#: files.c:427
#: files.c:433
#, c-format
msgid "Could not set permissions %o on %s: %s"
msgstr ""
#: files.c:434
#: files.c:440
#, c-format
msgid "Wrote %d lines"
msgstr ""
#: files.c:455
#: files.c:461
msgid "File Name to write"
msgstr ""
#: files.c:460
#: files.c:466
#, c-format
msgid "filename is %s"
msgstr ""
#: files.c:465
#: files.c:471
msgid "File exists, OVERWRITE ?"
msgstr ""