Commit a299b039 authored by Chris Allegretta's avatar Chris Allegretta
Browse files

Better fix for bug #29

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@107 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
No related merge requests found
Showing with 22 additions and 16 deletions
+22 -16
...@@ -45,5 +45,5 @@ ...@@ -45,5 +45,5 @@
- If nano opens a read-only file with the --tempfile option, and a change - 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 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 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]
...@@ -310,7 +310,7 @@ int write_file(char *name, int tmp) ...@@ -310,7 +310,7 @@ int write_file(char *name, int tmp)
if ((fd = open(name, O_APPEND, S_IRUSR | S_IWUSR | S_IRGRP | if ((fd = open(name, O_APPEND, S_IRUSR | S_IWUSR | S_IRGRP |
S_IWGRP | S_IROTH | S_IWOTH)) == -1) { S_IWGRP | S_IROTH | S_IWOTH)) == -1) {
UNSET(TEMP_OPT); UNSET(TEMP_OPT);
do_writeout(1); return do_writeout(1);
} }
else else
close(fd); close(fd);
...@@ -318,6 +318,10 @@ int write_file(char *name, int tmp) ...@@ -318,6 +318,10 @@ int write_file(char *name, int tmp)
if ((fd = open(name, O_WRONLY | O_CREAT | O_TRUNC, if ((fd = open(name, O_WRONLY | O_CREAT | O_TRUNC,
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH |
S_IWOTH)) == -1) { S_IWOTH)) == -1) {
if (ISSET(TEMP_OPT)) {
UNSET(TEMP_OPT);
return do_writeout(1);
}
statusbar(_("Could not open file for writing: %s"), statusbar(_("Could not open file for writing: %s"),
strerror(errno)); strerror(errno));
return -1; return -1;
...@@ -334,14 +338,16 @@ int write_file(char *name, int tmp) ...@@ -334,14 +338,16 @@ int write_file(char *name, int tmp)
strcat(buf, name); strcat(buf, name);
strcat(buf, ".XXXXXX"); strcat(buf, ".XXXXXX");
if ((fd = mkstemp(buf)) == -1) { if ((fd = mkstemp(buf)) == -1) {
if (ISSET(TEMP_OPT)) {
UNSET(TEMP_OPT);
return do_writeout(1);
}
statusbar(_("Could not open file for writing: %s"), statusbar(_("Could not open file for writing: %s"),
strerror(errno)); strerror(errno));
return -1; return -1;
} }
} }
dump_buffer(fileage); dump_buffer(fileage);
while (fileptr != NULL && fileptr->next != NULL) { while (fileptr != NULL && fileptr->next != NULL) {
/* Next line is so we discount the "magic line" */ /* Next line is so we discount the "magic line" */
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "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" "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,55 +55,55 @@ msgstr "" ...@@ -55,55 +55,55 @@ msgstr ""
msgid "File to insert [from ./] " msgid "File to insert [from ./] "
msgstr "" 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" msgid "Cancelled"
msgstr "" 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 #, c-format
msgid "Could not open file for writing: %s" msgid "Could not open file for writing: %s"
msgstr "" msgstr ""
#: files.c:329 #: files.c:333
msgid "Could not open file: Path length exceeded." msgid "Could not open file: Path length exceeded."
msgstr "" msgstr ""
#: files.c:357 #: files.c:363
#, c-format #, c-format
msgid "Wrote >%s\n" msgid "Wrote >%s\n"
msgstr "" msgstr ""
#: files.c:384 #: files.c:390
#, c-format #, c-format
msgid "Could not close %s: %s" msgid "Could not close %s: %s"
msgstr "" msgstr ""
#. Try a rename?? #. Try a rename??
#: files.c:405 files.c:416 files.c:421 #: files.c:411 files.c:422 files.c:427
#, c-format #, c-format
msgid "Could not open %s for writing: %s" msgid "Could not open %s for writing: %s"
msgstr "" msgstr ""
#: files.c:427 #: files.c:433
#, c-format #, c-format
msgid "Could not set permissions %o on %s: %s" msgid "Could not set permissions %o on %s: %s"
msgstr "" msgstr ""
#: files.c:434 #: files.c:440
#, c-format #, c-format
msgid "Wrote %d lines" msgid "Wrote %d lines"
msgstr "" msgstr ""
#: files.c:455 #: files.c:461
msgid "File Name to write" msgid "File Name to write"
msgstr "" msgstr ""
#: files.c:460 #: files.c:466
#, c-format #, c-format
msgid "filename is %s" msgid "filename is %s"
msgstr "" msgstr ""
#: files.c:465 #: files.c:471
msgid "File exists, OVERWRITE ?" msgid "File exists, OVERWRITE ?"
msgstr "" msgstr ""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment