aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman <[email protected]>1994-11-17 16:10:36 +0000
committerRichard M. Stallman <[email protected]>1994-11-17 16:10:36 +0000
commit8600e6edbad67efacd43e26865e20629fb459600 (patch)
treea8ae14c6e06ae8d147cdbd9c15411f61b72de0f4 /src
parent7c7daa220d9fdd567211537f383861996308249a (diff)
(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 eefeed195f..f7e2157667 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.")
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)));