Changeset: f66d4e6c562f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f66d4e6c562f
Modified Files:
        gdk/gdk_bbp.c
Branch: Jul2017
Log Message:

Now that we don't chdir into the farm, use an offset for the farm root.


diffs (61 lines):

diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -402,7 +402,7 @@ recover_dir(int farmid, int direxists)
 
 static gdk_return BBPrecover(int farmid);
 static gdk_return BBPrecover_subdir(void);
-static int BBPdiskscan(const char *);
+static int BBPdiskscan(const char *, size_t);
 
 #ifdef GDKLIBRARY_SORTEDPOS
 static void
@@ -1147,7 +1147,7 @@ BBPreadEntries(FILE *fp, int bbpversion)
                           &properties,
                           &count, &capacity, &base,
                           &nread) < 8)
-                       GDKfatal("BBPinit: invalid format for BBP.dir%s", buf);
+                       GDKfatal("BBPinit: invalid format for BBP.dir\n%s", 
buf);
 
                /* convert both / and \ path separators to our own DIR_SEP */
 #if DIR_SEP != '/'
@@ -1453,7 +1453,7 @@ BBPinit(void)
                        char *d = GDKfilepath(i, NULL, BATDIR, NULL);
                        if (d == NULL)
                                GDKfatal("BBPinit: malloc failed\n");
-                       BBPdiskscan(d);
+                       BBPdiskscan(d, strlen(d) - strlen(BATDIR));
                        GDKfree(d);
                }
        }
@@ -3656,7 +3656,7 @@ getdesc(bat bid)
 }
 
 static int
-BBPdiskscan(const char *parent)
+BBPdiskscan(const char *parent, size_t baseoff)
 {
        DIR *dirp = opendir(parent);
        struct dirent *dent;
@@ -3686,9 +3686,9 @@ BBPdiskscan(const char *parent)
                        continue;       /* ignore .dot files and directories (. 
..) */
 
                if (strncmp(dent->d_name, "BBP.", 4) == 0 &&
-                   (strcmp(parent, BATDIR) == 0 ||
-                    strncmp(parent, BAKDIR, strlen(BAKDIR)) == 0 ||
-                    strncmp(parent, SUBDIR, strlen(SUBDIR)) == 0))
+                   (strcmp(parent + baseoff, BATDIR) == 0 ||
+                    strncmp(parent + baseoff, BAKDIR, strlen(BAKDIR)) == 0 ||
+                    strncmp(parent + baseoff, SUBDIR, strlen(SUBDIR)) == 0))
                        continue;
 
                p = strchr(dent->d_name, '.');
@@ -3706,7 +3706,7 @@ BBPdiskscan(const char *parent)
                strncpy(dst, dent->d_name, dstlen);
                fullname[sizeof(fullname) - 1] = 0;
 
-               if (p == NULL && BBPdiskscan(fullname) == 0) {
+               if (p == NULL && BBPdiskscan(fullname, baseoff) == 0) {
                        /* it was a directory */
                        continue;
                }
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to