aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1994-11-17 16:10:36 +0000
committerRichard M. Stallman1994-11-17 16:10:36 +0000
commit8600e6edbad67efacd43e26865e20629fb459600 (patch)
treea8ae14c6e06ae8d147cdbd9c15411f61b72de0f4 /src
parent7c7daa220d9fdd567211537f383861996308249a (diff)
downloademacs-8600e6edbad67efacd43e26865e20629fb459600.tar.gz
emacs-8600e6edbad67efacd43e26865e20629fb459600.zip
(init_filelock): Always copy lock_path.
Diffstat (limited to 'src')
-rw-r--r--src/filelock.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/filelock.c b/src/filelock.c
index eefeed195f7..f7e21576678 100644
--- a/src/filelock.c
+++ b/src/filelock.c
@@ -455,18 +455,20 @@ t if it is locked by you, else a string of the name of the locker.")
455 455
456init_filelock () 456init_filelock ()
457{ 457{
458 char *new_path
459
458 lock_path = egetenv ("EMACSLOCKDIR"); 460 lock_path = egetenv ("EMACSLOCKDIR");
459 if (! lock_path) 461 if (! lock_path)
460 lock_path = PATH_LOCK; 462 lock_path = PATH_LOCK;
461 463
464 /* Copy the path in case egetenv got it from a Lisp string. */
465 new_path = (char *) xmalloc (strlen (lock_path) + 2);
466 strcpy (new_path, lock_path);
467 lock_path = new_path;
468
462 /* Make sure it ends with a slash. */ 469 /* Make sure it ends with a slash. */
463 if (lock_path[strlen (lock_path) - 1] != '/') 470 if (lock_path[strlen (lock_path) - 1] != '/')
464 { 471 strcat (lock_path, "/");
465 char *new_path = (char *) xmalloc (strlen (lock_path) + 2);
466 strcpy (new_path, lock_path);
467 lock_path = new_path;
468 strcat (lock_path, "/");
469 }
470 472
471 superlock_path = (char *) xmalloc ((strlen (lock_path) 473 superlock_path = (char *) xmalloc ((strlen (lock_path)
472 + sizeof (SUPERLOCK_NAME))); 474 + sizeof (SUPERLOCK_NAME)));