Changeset: 7fc9a99fb490 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7fc9a99fb490
Modified Files:
        monetdb5/mal/mal_exception.h
        sql/backends/monet5/sql.c
        tools/merovingian/daemon/argvcmds.c
Branch: default
Log Message:

Merge with Oct2014 branch.


diffs (92 lines):

diff --git a/monetdb5/mal/mal_exception.h b/monetdb5/mal/mal_exception.h
--- a/monetdb5/mal/mal_exception.h
+++ b/monetdb5/mal/mal_exception.h
@@ -24,7 +24,7 @@
 /* #define _DEBUG_EXCEPTION_           trace the exception handling */
 
 /* These are the exceptions known, adding new ones here requires to also
- * add the "full" name to the exceptionNames array below */
+ * add the "full" name to the exceptionNames array in mal_exception.c */
 enum malexception {
        MAL=0,
        ILLARG,
diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -2764,29 +2764,58 @@ mvc_import_table_wrap(Client cntxt, MalB
                return msg;
        be = cntxt->sqlcontext;
        len = strlen((char *) (*T));
-       GDKstrFromStr(tsep = GDKmalloc(len + 1), *T, len);
+       if ((tsep = GDKmalloc(len + 1)) == NULL)
+               throw(MAL, "sql.copy_from", MAL_MALLOC_FAIL);
+       GDKstrFromStr(tsep, *T, len);
        len = 0;
        len = strlen((char *) (*R));
-       GDKstrFromStr(rsep = GDKmalloc(len + 1), *R, len);
+       if ((rsep = GDKmalloc(len + 1)) == NULL) {
+               GDKfree(tsep);
+               throw(MAL, "sql.copy_from", MAL_MALLOC_FAIL);
+       }
+       GDKstrFromStr(rsep, *R, len);
        len = 0;
        if (*S && strcmp(str_nil, *(char **) S)) {
                len = strlen((char *) (*S));
+               if ((ssep = GDKmalloc(len + 1)) == NULL) {
+                       GDKfree(tsep);
+                       GDKfree(rsep);
+                       throw(MAL, "sql.copy_from", MAL_MALLOC_FAIL);
+               }
                GDKstrFromStr(ssep = GDKmalloc(len + 1), *S, len);
                len = 0;
        }
 
-       STRcodeset(&cs);
-       STRIconv(&filename, fname, &utf8, &cs);
+       /* convert UTF-8 encoded file name to the character set of our
+        * own locale before passing it on to the system call */
+       if ((msg = STRcodeset(&cs)) != MAL_SUCCEED ||
+           (msg = STRIconv(&filename, fname, &utf8, &cs)) != MAL_SUCCEED) {
+               GDKfree(tsep);
+               GDKfree(rsep);
+               GDKfree(ssep);
+               return msg;
+       }
+
        GDKfree(cs);
        len = strlen((char *) (*N));
-       GDKstrFromStr(ns = GDKmalloc(len + 1), *N, len);
+       if ((ns = GDKmalloc(len + 1)) == NULL) {
+               GDKfree(tsep);
+               GDKfree(rsep);
+               GDKfree(ssep);
+               throw(MAL, "sql.copy_from", MAL_MALLOC_FAIL);
+       }
+       GDKstrFromStr(ns, *N, len);
        len = 0;
        ss = open_rastream(filename);
        if (!ss || mnstr_errnr(ss)) {
                int errnr = mnstr_errnr(ss);
                if (ss)
                        mnstr_destroy(ss);
-               throw(IO, "streams.open", "could not open file '%s': %s", 
filename, strerror(errnr));
+               GDKfree(tsep);
+               GDKfree(rsep);
+               GDKfree(ssep);
+               GDKfree(ns);
+               throw(IO, "sql.copy_from", "could not open file '%s': %s", 
filename, strerror(errnr));
        }
 #if SIZEOF_VOID_P == 4
        s = bstream_create(ss, 0x20000);
diff --git a/tools/merovingian/daemon/argvcmds.c 
b/tools/merovingian/daemon/argvcmds.c
--- a/tools/merovingian/daemon/argvcmds.c
+++ b/tools/merovingian/daemon/argvcmds.c
@@ -55,7 +55,7 @@ command_help(int argc, char *argv[])
        } else if (strcmp(argv[1], "start") == 0) {
                printf("usage: monetdbd start [-n] <dbfarm>\n");
                printf("  Starts the monetdbd deamon for the given dbfarm.\n");
-               printf("  When -n is given, monetdbd will not fork into the 
background.");
+               printf("  When -n is given, monetdbd will not fork into the 
background.\n");
        } else if (strcmp(argv[1], "stop") == 0) {
                printf("usage: monetdbd stop <dbfarm>\n");
                printf("  Stops a running monetdbd deamon for the given 
dbfarm.\n");
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to