Work locking mechanisms for concurrent updates/commit.
[idzebra-moved-to-github.git] / index / lockutil.c
1 /*
2  * Copyright (C) 1994-1995, Index Data I/S 
3  * All rights reserved.
4  * Sebastian Hammer, Adam Dickmeiss
5  *
6  * $Log: lockutil.c,v $
7  * Revision 1.1  1995-12-07 17:38:47  adam
8  * Work locking mechanisms for concurrent updates/commit.
9  *
10  */
11 #include <stdio.h>
12 #include <assert.h>
13 #include <unistd.h>
14 #include <sys/file.h>
15 #include <fcntl.h>
16 #include <string.h>
17 #include <errno.h>
18
19 #include <alexutil.h>
20 #include "index.h"
21
22 static char *lockDir = NULL;
23
24 void zebraLockPrefix (char *pathPrefix)
25 {
26     if (!lockDir)
27         lockDir = res_get_def (common_resource, "lockDir", "");
28     assert (lockDir);
29     
30     strcpy (pathPrefix, lockDir);
31     if (*pathPrefix && pathPrefix[strlen(pathPrefix)-1] != '/')
32         strcat (pathPrefix, "/");
33 }