summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2003-07-27 19:54:27 +0000
committerLennart Poettering <lennart@poettering.net>2003-07-27 19:54:27 +0000
commitce358c24ef7426e8e3013185f60b724fe86faa61 (patch)
tree91127eee0daffe17ee1f45da6628e39014ae9982 /src
parent14db0c158e42c2f723fef9105551769b6e8436ec (diff)
locking
git-svn-id: file:///home/lennart/svn/public/ivcall/trunk@4 e0b13411-74c3-0310-b366-a0654dd0340f
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am2
-rw-r--r--src/ivcall.c4
-rw-r--r--src/lock.c8
3 files changed, 7 insertions, 7 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 1fa04d5..ad3f137 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -16,6 +16,8 @@
# along with ifplugd; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+AM_CFLAGS=-DLOCK_DIR=\"$(LOCK_DIR)\"
+
bin_PROGRAMS = ivcall
ivcall_SOURCES = ivcall.c lock.c lock.h util.c util.h
diff --git a/src/ivcall.c b/src/ivcall.c
index 54c840d..bccd290 100644
--- a/src/ivcall.c
+++ b/src/ivcall.c
@@ -42,10 +42,6 @@
#include "config.h"
#endif
-// Where do lockfiles reside?
-#ifndef LOCK_PATH
-#define LOCK_PATH "/var/lock"
-#endif
// Those nifty DLE-sequences
#define DLE 0x10
diff --git a/src/lock.c b/src/lock.c
index 465736c..eb8a3cb 100644
--- a/src/lock.c
+++ b/src/lock.c
@@ -34,7 +34,9 @@
#include "util.h"
// Where do lockfiles reside?
-#define LOCK_PATH "/var/lock"
+#ifndef LOCK_DIR
+#define LOCK_DIR "/var/lock"
+#endif
static char* lockfile = NULL;
@@ -48,10 +50,10 @@ int device_lock(char *dev, char *appname) {
assert(dev && !lockfile);
- if (access(LOCK_PATH, W_OK) < 0)
+ if (access(LOCK_DIR, W_OK) < 0)
return -1;
- snprintf(path, sizeof(path), "%s/LCK..%s", LOCK_PATH, basename(dev));
+ snprintf(path, sizeof(path), "%s/LCK..%s", LOCK_DIR, basename(dev));
if ((fd = open(path, O_RDONLY)) >= 0) {
int n = loop_read(fd, buf, sizeof(buf) - 1);