aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
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)));