Update of /cvsroot/monetdb/sql/src/backends/monet5
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv3319
Modified Files:
merovingian.mx
Log Message:
Trying to get merovingian truely detach on Solaris, changes related to
that, which are general practice, so should bring us closer to that
objective. It still locks up the tty on disconnect, though.
Side effect: since we need to chdir to a proper/known location, we now
also give a clear error when the dbfarm doesn't exist:
% $INSTALL_DIR/bin/merovingian
could not move to dbfarm
'/ufs/fabian/scratch/monetdb/current/program-i86pc/var/MonetDB5/dbfarm-test':
No such file or directory, please create directory first
U merovingian.mx
Index: merovingian.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/merovingian.mx,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -d -r1.63 -r1.64
--- merovingian.mx 26 Oct 2008 08:09:26 -0000 1.63
+++ merovingian.mx 26 Oct 2008 11:10:57 -0000 1.64
@@ -510,9 +510,6 @@
dup2(pfde[1], 2);
close(pfde[1]);
- /* we don't use stdin, neither should mserver ... */
- close(0);
-
/* ok, now exec that mserver we want */
snprintf(conffile, 511, "--config=%s", _merovingian_conffile);
snprintf(dbname, 511, "--dbname=%s", database);
@@ -1811,7 +1808,11 @@
case 0:
/* detach client from controlling tty, we only write to
the
* pipe to daddy */
- close(0);
+ if (setsid() < 0)
+ fprintf(stderr, "hmmm, can't detach from
controlling tty, continuing anyway\n");
+ retfd = open("/dev/null", O_RDONLY);
+ dup2(retfd, 0);
+ close(retfd);
close(pfd[0]); /* close unused read end */
retfd = pfd[1]; /* store the write end */
break;
@@ -1941,6 +1942,16 @@
return(1);
}
+ /* chdir to dbfarm so we are at least in a known to exist location */
+ if (chdir(dbfarm) < 0) {
+ fprintf(stderr, "could not move to dbfarm '%s': %s, "
+ "please create directory first\n",
+ dbfarm, strerror(errno));
+ fflush(stderr);
+ MERO_EXIT(1);
+ return(1);
+ }
+
/* we need a pidfile */
if (pidfilename == NULL) {
fprintf(stderr, "cannot find pidfilename via config file\n");
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins