Added code to check to see if using -l and the file is not fact a link.  Please test


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@111 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
diff --git a/BUGS b/BUGS
index 418a027..d377b97 100644
--- a/BUGS
+++ b/BUGS
@@ -28,7 +28,7 @@
 - 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) [FIXED mostly]
+  user exit (29, discovered by Joshua Jensen) [FIXED]
 
 ** Open BUGS **
 
diff --git a/ChangeLog b/ChangeLog
index e381a87..77c79c5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -21,6 +21,12 @@
   read_file():
 	- Added init of buf variable, hopefully this will stop the 
 	  "bleeding" of text seen with mutt and using i18n.
+  write_file():
+	- Added code to check to see if using -l and the file is not
+	  in fact a link.  This should fix the behavior where a file
+	  that does not have write permission but could be removed and
+	  rewritten is saved without error.  Please test this feature
+	  and give feedback.
 - search.c:
   search_init():
 	- Added " (to replace)" statement to end of search string if 
diff --git a/files.c b/files.c
index a4198ff..57f5c1b 100644
--- a/files.c
+++ b/files.c
@@ -300,8 +300,13 @@
     fileptr = fileage;
 
 
+    /* Check to see if the file is a regular file and FOLLOW_SYMLINKS is
+       set.  If so then don't do the delete and recreate code which would
+       cause unexpected behavior */
+    lstat(name, &st);
+
     /* Open the file and truncate it.  Trust the symlink. */
-    if (ISSET(FOLLOW_SYMLINKS) && !tmp) {
+    if ((ISSET(FOLLOW_SYMLINKS) || !S_ISLNK(st.st_mode)) && !tmp) {
 	/*
 	 * If TEMP_OPT == 1, check to see if we can append to the file
 	 * first, i.e. to see if we can at least write to the file (stops
diff --git a/po/nano.pot b/po/nano.pot
index 4520fc6..1ad92f6 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-18 21:16-0400\n"
+"POT-Creation-Date: 2000-07-21 18:43-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 @@
 msgid "File to insert [from ./] "
 msgstr ""
 
-#: files.c:272 files.c:296 files.c:483 nano.c:1147
+#: files.c:272 files.c:296 files.c:488 nano.c:1147
 msgid "Cancelled"
 msgstr ""
 
-#: files.c:326 files.c:346 files.c:359 files.c:376 files.c:382
+#: files.c:331 files.c:351 files.c:364 files.c:381 files.c:387
 #, c-format
 msgid "Could not open file for writing: %s"
 msgstr ""
 
-#: files.c:334
+#: files.c:339
 msgid "Could not open file: Path length exceeded."
 msgstr ""
 
-#: files.c:364
+#: files.c:369
 #, c-format
 msgid "Wrote >%s\n"
 msgstr ""
 
-#: files.c:391
+#: files.c:396
 #, c-format
 msgid "Could not close %s: %s"
 msgstr ""
 
 #. Try a rename??
-#: files.c:412 files.c:423 files.c:428
+#: files.c:417 files.c:428 files.c:433
 #, c-format
 msgid "Could not open %s for writing: %s"
 msgstr ""
 
-#: files.c:434
+#: files.c:439
 #, c-format
 msgid "Could not set permissions %o on %s: %s"
 msgstr ""
 
-#: files.c:441
+#: files.c:446
 #, c-format
 msgid "Wrote %d lines"
 msgstr ""
 
-#: files.c:462
+#: files.c:467
 msgid "File Name to write"
 msgstr ""
 
-#: files.c:467
+#: files.c:472
 #, c-format
 msgid "filename is %s"
 msgstr ""
 
-#: files.c:472
+#: files.c:477
 msgid "File exists, OVERWRITE ?"
 msgstr ""