]> git.wh0rd.org Git - nano.git/commitdiff
revert erroneous change
authorDavid Lawrence Ramsey <pooka109@gmail.com>
Fri, 15 Dec 2006 02:49:44 +0000 (02:49 +0000)
committerDavid Lawrence Ramsey <pooka109@gmail.com>
Fri, 15 Dec 2006 02:49:44 +0000 (02:49 +0000)
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4000 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

src/files.c

index eae0ff475233c9d48fe6972bcd199e980e4d5d5b..35dbb2283d1b1d12edeebae9d0d3f679f49a1ed0 100644 (file)
@@ -1906,31 +1906,33 @@ int do_writeout(bool exiting)
                if (full_answer != NULL)
                    free(full_answer);
 
-               if (name_exists) {
+               if (different_name) {
+                   if (name_exists) {
+                       /* If we're using restricted mode, we aren't
+                        * allowed to save a new file under the name of
+                        * an existing file. */
+                       if (ISSET(RESTRICTED))
+                           continue;
+
+                       i = do_yesno_prompt(FALSE,
+                               _("File exists, OVERWRITE ? "));
+                       if (i == 0 || i == -1)
+                           continue;
                    /* If we're using restricted mode, we aren't allowed
-                    * to save a new file under the name of an existing
-                    * file. */
-                   if (ISSET(RESTRICTED))
-                       continue;
-
-                   i = do_yesno_prompt(FALSE,
-                       _("File exists, OVERWRITE ? "));
-                   if (i == 0 || i == -1)
-                       continue;
-               /* If we're using restricted mode, we aren't allowed to
-                * change the name of a file once it has one, because
-                * that would allow reading from or writing to files not
-                * specified on the command line. */
-               } else if (different_name && !ISSET(RESTRICTED) &&
+                    * to change the name of a file once it has one,
+                    * because that would allow reading from or writing
+                    * to files not specified on the command line. */
+                   } else if (!ISSET(RESTRICTED) &&
                        openfile->filename[0] != '\0'
 #ifndef NANO_TINY
                        && (exiting || !openfile->mark_set)
 #endif
                        ) {
-                   i = do_yesno_prompt(FALSE, 
-                       _("Save file under DIFFERENT NAME ? "));
-                   if (i == 0 || i == -1)
-                       continue;
+                       i = do_yesno_prompt(FALSE,
+                               _("Save file under DIFFERENT NAME ? "));
+                       if (i == 0 || i == -1)
+                           continue;
+                   }
                }
            }