From: Chris Allegretta Date: Fri, 14 Jul 2000 02:44:02 +0000 (+0000) Subject: Better fix for bug #29 X-Git-Tag: v0.9.13~7 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=a299b039c42d6d3c5864674851d305c97d3b6ba3;p=nano.git Better fix for bug #29 git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@107 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/BUGS b/BUGS index 8951902e..d91bcf73 100644 --- a/BUGS +++ b/BUGS @@ -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] diff --git a/files.c b/files.c index 5b9f5ec7..887269b5 100644 --- a/files.c +++ b/files.c @@ -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" */ diff --git a/po/nano.pot b/po/nano.pot index b0f7042e..bea43d26 100644 --- a/po/nano.pot +++ b/po/nano.pot @@ -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 \n" "Language-Team: LANGUAGE \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 ""