contrib/ckermit/lockdir.patch
2014-09-12 20:17:35 +10:00

49 lines
1.5 KiB
Diff

commit f956d739e9b1451eff1592fa640358877dcf958c
Author: Samuel Tardieu <sam@rfc1149.net>
Date: Thu Jul 19 20:53:24 2012 +0200
Use LOCK_DIR environment variable if defined instead of /var/lock
diff --git a/ckutio.c b/ckutio.c
index 05564de..14b11cd 100644
--- a/ckutio.c
+++ b/ckutio.c
@@ -4971,6 +4971,11 @@ ttglckdir() { /* Get Lockfile directory name */
#endif /* __OpenBSD__ */
}
+char *get_lockdir() {
+ char *lockdir = getenv("LOCK_DIR");
+ return lockdir ? lockdir : LOCK_DIR;
+}
+
static int
ttlock(ttdev) char *ttdev; {
@@ -5077,8 +5082,7 @@ ttlock(ttdev) char *ttdev; {
char symlock[LFNAML]; /* Name for symlink lockfile name */
#endif /* CKSYMLINK */
char tmpnam[LFNAML+30]; /* Temporary lockfile name. */
- char *lockdir = LOCK_DIR; /* Defined near top of this file, */
- /* or on cc command line. */
+ char *lockdir = get_lockdir();
haslock = 0; /* Not locked yet. */
*flfnam = '\0'; /* Lockfile name is empty. */
lock2[0] = '\0'; /* Clear secondary lockfile name. */
diff --git a/ckuus4.c b/ckuus4.c
index 946603a..ba9afaf 100644
--- a/ckuus4.c
+++ b/ckuus4.c
@@ -13882,8 +13882,9 @@ nvlook(s) char *s; {
#ifdef UNIX
case VN_LCKDIR: {
#ifndef NOUUCP
- extern char * uucplockdir;
- ckstrncpy(vvbuf,uucplockdir,VVBUFL);
+ extern char *get_lockdir();
+ char * lockdir = get_lockdir();
+ ckstrncpy(vvbuf,lockdir,VVBUFL);
x = strlen(vvbuf);
if (x > 0) {
if (vvbuf[x-1] != '/') {