Update of /cvsroot/monetdb/sql/src/backends/monet5
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv7379
Modified Files:
merovingian.mx
Log Message:
Create dbfarm if it doesn't exist (recursively up till the root).
Rationale behind this is that a "dbinit" or alike does not make sense
for a dbfarm, since all it takes is to create a directory. Hence, if a
user sets up some path in his monetdb5.conf we just assume he/she meant
to create that directory if it didn't exist yet.
U merovingian.mx
Index: merovingian.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/merovingian.mx,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -d -r1.64 -r1.65
--- merovingian.mx 26 Oct 2008 11:10:57 -0000 1.64
+++ merovingian.mx 26 Oct 2008 12:43:05 -0000 1.65
@@ -1940,12 +1940,36 @@
fflush(stderr);
MERO_EXIT(1);
return(1);
+ } else {
+ /* check if dbfarm actually exists */
+ struct stat statbuf;
+ if (stat(dbfarm, &statbuf) == -1) {
+ /* try to create the dbfarm */
+ char *p = dbfarm;
+ while ((p = strchr(p + 1, '/')) != NULL) {
+ *p = '\0';
+ if (stat(dbfarm, &statbuf) == -1 &&
mkdir(dbfarm, 0755)) {
+ fprintf(stderr, "unable to create
directory '%s': %s\n",
+ dbfarm,
strerror(errno));
+ fflush(stderr);
+ MERO_EXIT(1);
+ return(1);
+ }
+ *p = '/';
+ }
+ }
+ if (mkdir(dbfarm, 0755)) {
+ fprintf(stderr, "unable to create directory '%s': %s\n",
+ dbfarm, strerror(errno));
+ fflush(stderr);
+ MERO_EXIT(1);
+ 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",
+ fprintf(stderr, "could not move to dbfarm '%s': %s\n",
dbfarm, strerror(errno));
fflush(stderr);
MERO_EXIT(1);
-------------------------------------------------------------------------
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