changeset 9992:5666a2d5b2bc

(init_filelock): Always copy lock_path.
author Richard M. Stallman <rms@gnu.org>
date Thu, 17 Nov 1994 16:10:36 +0000
parents 8deb32278622
children 26f63d276d89
files src/filelock.c
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/filelock.c	Thu Nov 17 16:01:49 1994 +0000
+++ b/src/filelock.c	Thu Nov 17 16:10:36 1994 +0000
@@ -455,18 +455,20 @@
 
 init_filelock ()
 {
+  char *new_path
+
   lock_path = egetenv ("EMACSLOCKDIR");
   if (! lock_path)
     lock_path = PATH_LOCK;
 
+  /* Copy the path in case egetenv got it from a Lisp string.  */
+  new_path = (char *) xmalloc (strlen (lock_path) + 2);
+  strcpy (new_path, lock_path);
+  lock_path = new_path;
+
   /* Make sure it ends with a slash.  */
   if (lock_path[strlen (lock_path) - 1] != '/')
-    {
-      char *new_path = (char *) xmalloc (strlen (lock_path) + 2);
-      strcpy (new_path, lock_path);
-      lock_path = new_path;
-      strcat (lock_path, "/");
-    }
+    strcat (lock_path, "/");
 
   superlock_path = (char *) xmalloc ((strlen (lock_path)
 				      + sizeof (SUPERLOCK_NAME)));