summaryrefslogtreecommitdiffstats
path: root/src/lock.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lock.c')
-rw-r--r--src/lock.c33
1 files changed, 27 insertions, 6 deletions
diff --git a/src/lock.c b/src/lock.c
index efce0bb..f629ee0 100644
--- a/src/lock.c
+++ b/src/lock.c
@@ -1,3 +1,27 @@
+/* $Id$ */
+
+/***
+ This file is part of ivam2.
+
+ ivam2 is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ ivam2 is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+ License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with ivam2; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+***/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <unistd.h>
#include <sys/stat.h>
#include <stdio.h>
@@ -16,12 +40,9 @@
#include "util.h"
#include "main.h"
-/* Where do lockfiles reside? */
-#define LOCK_PATH "/var/lock"
-
static const char *lockfile(const char *dev) {
static char lockfile[PATH_MAX];
- snprintf(lockfile, sizeof(lockfile), "%s/LCK..%s", LOCK_PATH, basename((char*) dev));
+ snprintf(lockfile, sizeof(lockfile), "%s/LCK..%s", LOCKDIR, basename((char*) dev));
return lockfile;
}
@@ -38,8 +59,8 @@ int device_lock(const char *dev) {
char buf[100];
char uidbuf[32];
- if (stat(LOCK_PATH, &st) != 0 || !S_ISDIR(st.st_mode)) {
- daemon_log(LOG_ERR, "Failed to lock device, directory "LOCK_PATH" not existent.");
+ if (stat(LOCKDIR, &st) != 0 || !S_ISDIR(st.st_mode)) {
+ daemon_log(LOG_ERR, "Failed to lock device, directory "LOCKDIR" not existent.");
return -1;
}