From 8600e6edbad67efacd43e26865e20629fb459600 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Thu, 17 Nov 1994 16:10:36 +0000 Subject: (init_filelock): Always copy lock_path. --- src/filelock.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src') 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))); -- cgit v1.2.3