Changeset: c146f4f65fb3 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c146f4f65fb3
Modified Files:
        gdk/gdk_batop.mx
        gdk/gdk_bbp.mx
Branch: default
Log Message:

Merge with Oct2010 branch.


diffs (95 lines):

diff -r a405edfb8d97 -r c146f4f65fb3 gdk/gdk_batop.mx
--- a/gdk/gdk_batop.mx  Fri Jan 14 15:38:54 2011 +0100
+++ b/gdk/gdk_batop.mx  Fri Jan 14 15:42:45 2011 +0100
@@ -240,7 +240,7 @@
 {
        BAT *tmp = NULL, *res = NULL;
        int fastpath = 0;
-       int countonly = (b->htype == TYPE_void && b->ttype == TYPE_void);
+       int countonly;
 
        if (b == NULL || n == NULL || BATcount(n) == 0) {
                return b;
@@ -248,6 +248,8 @@
        ALIGNins(b, "BATins", force);
        BATcompatible(b, n);
 
+       countonly = (b->htype == TYPE_void && b->ttype == TYPE_void);
+
        if (BUNlast(b) + BATcount(n) > BUN_MAX) {
                GDKerror("BATins: combined BATs too large\n");
                return NULL;
diff -r a405edfb8d97 -r c146f4f65fb3 gdk/gdk_bbp.mx
--- a/gdk/gdk_bbp.mx    Fri Jan 14 15:38:54 2011 +0100
+++ b/gdk/gdk_bbp.mx    Fri Jan 14 15:42:45 2011 +0100
@@ -3689,8 +3689,7 @@
                long_str kill_ext;
                long_str path;
 
-               strcpy(kill_ext, ext);
-               strcat(kill_ext, ".kill");
+               snprintf(kill_ext, sizeof(kill_ext), "%s.kill", ext);
                GDKfilepath(path, dstdir, nme, kill_ext);
                fp = fopen(path, "w");
                IODEBUG THRprintf(GDKout, "#open %s = %d\n", path, fp ? 0 : -1);
@@ -3791,7 +3790,8 @@
        s = strrchr(srcdir, DIR_SEP);
        if (!s)
                return -1;
-       strcpy(nme, ++s);
+       strncpy(nme, ++s, sizeof(nme));
+       nme[sizeof(nme) - 1] = 0;
        srcdir[s - srcdir] = 0;
 
 @= backup
@@ -3823,8 +3823,7 @@
                }
                        if (subcommit && (@2->storage == STORE_PRIV || 
@2->newstorage == STORE_PRIV)) {
                        long_str kill_ext;
-                       strcpy(kill_ext, ext);
-                       strcat(kill_ext, ".new.kill");
+                       snprintf(kill_ext, sizeof(kill_ext), "%s.new.kill", 
ext);
                        if (file_exists(BAKDIR, nme, kill_ext)) {
                                ret |= file_move(BAKDIR, SUBDIR, nme, kill_ext);
                        }
@@ -4189,15 +4188,20 @@
        struct dirent *dent;
        long_str fullname;
        str dst = fullname;
+       size_t dstlen = sizeof(fullname);
        const char *src = parent;
 
        if (dirp == NULL)
                return -1;      /* nothing to do */
 
-       while (*src)
+       while (*src) {
                *dst++ = *src++;
-       if (dst[-1] != DIR_SEP)
+               dstlen--;
+       }
+       if (dst > fullname && dst[-1] != DIR_SEP) {
                *dst++ = DIR_SEP;
+               dstlen--;
+       }
 
        while ((dent = readdir(dirp)) != NULL) {
                str p;
@@ -4219,7 +4223,16 @@
                ok = p && bid;
                delete = FALSE;
 
-               strcpy(dst, dent->d_name);
+               if (strlen(dent->d_name) >= dstlen) {
+                       /* found a file with too long a name
+                          (i.e. unknown); stop pruning in this
+                          subdir */
+                       IODEBUG THRprintf(GDKout, "BBPdiskscan: unexpected file 
%s, leaving %s.\n", dent->d_name, parent);
+                       break;
+               }
+               strncpy(dst, dent->d_name, dstlen);
+               fullname[sizeof(fullname) - 1] = 0;
+
                if (p == NULL && BBPdiskscan(fullname) == 0) {
                        /* it was a directory */
                        continue;
_______________________________________________
Checkin-list mailing list
Checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to