]> git.eshelyaron.com Git - emacs.git/commitdiff
(init_filelock): Always copy lock_path.
authorRichard M. Stallman <rms@gnu.org>
Thu, 17 Nov 1994 16:10:36 +0000 (16:10 +0000)
committerRichard M. Stallman <rms@gnu.org>
Thu, 17 Nov 1994 16:10:36 +0000 (16:10 +0000)
src/filelock.c

index eefeed195f72c3f4f56e3be24c05d0c5bb6b53c0..f7e2157667806e560084a3c15e1acd9641949c65 100644 (file)
@@ -455,18 +455,20 @@ t if it is locked by you, else a string of the name of the locker.")
 
 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)));