Update of /cvsroot/monetdb/MonetDB5/src/tools
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv11211
Modified Files:
merovingian.mx
Log Message:
Don't lie to the caller that another merovingian process is running when
it simply couldn't create a lock.
Index: merovingian.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/tools/merovingian.mx,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- merovingian.mx 10 Sep 2007 13:55:21 -0000 1.49
+++ merovingian.mx 11 Sep 2007 09:45:45 -0000 1.50
@@ -1047,11 +1047,12 @@
int ret;
int sock = 0;
- /* hunt for the config file, and read it */
+ /* where is the binary we call? */
snprintf(buf, 1023, "%s/bin/mserver5", MONETDBPREFIX);
_merovingian_mserver = alloca(sizeof(char) * (strlen(buf) + 1));
memcpy(_merovingian_mserver, buf, strlen(buf) + 1);
+ /* hunt for the config file, and read it */
snprintf(buf, 1023, "%s%s", MONETDBPREFIX, conf + 9);
cnf = fopen(buf, "r");
if (cnf == NULL) {
@@ -1096,11 +1097,17 @@
snprintf(buf, 1024, "%s/.merovingian_lock", dbfarm);
/* we leak ret, but that doesn't matter as the file needs to remain
* available, otherwise we loose the lock */
- if ((ret = MT_lockf(buf, F_TLOCK, 4, 1)) < 0) {
+ if ((ret = MT_lockf(buf, F_TLOCK, 4, 1)) == -1) {
/* locking failed */
fprintf(stderr, "another merovingian is already running\n");
fflush(stderr);
exit(1);
+ } else if (ret == -2) {
+ /* directory or something doesn't exist */
+ fprintf(stderr, "unable to create .merovingian_lock file in %s:
%s\n",
+ dbfarm, strerror(errno));
+ fflush(stderr);
+ exit(1);
}
snprintf(buf, 1024, "%s/.merovingian_control", dbfarm);
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins