# HG changeset patch # User Richard M. Stallman # Date 785088636 0 # Node ID 5666a2d5b2bce7ce05453276ef16b6fd6d34713f # Parent 8deb322786226ddfd97cecd817b18ed545f2da8c (init_filelock): Always copy lock_path. diff -r 8deb32278622 -r 5666a2d5b2bc src/filelock.c --- 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)));