summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2021-04-05 18:33:37 +0200
committerOlivier Bertrand <bertrandop@gmail.com>2021-04-05 18:33:37 +0200
commit2aefe0bee1fc1bb74f1e02448825917183c305e5 (patch)
tree18624d709cdcc92ecb4eb2b0ca2e9e563922119b
parentcaff19ada53f7414b646d0b46a927e1b8a22fd8e (diff)
downloadmariadb-git-2aefe0bee1fc1bb74f1e02448825917183c305e5.tar.gz
- Fix crash when not specifying the collection for MongoDB
modified: storage/connect/cmgoconn.cpp - Fix(?) Linux compile errors modified: storage/connect/tabrest.cpp
-rw-r--r--storage/connect/cmgoconn.cpp6
-rw-r--r--storage/connect/tabrest.cpp2
2 files changed, 7 insertions, 1 deletions
diff --git a/storage/connect/cmgoconn.cpp b/storage/connect/cmgoconn.cpp
index edee1874b97..474f940a8cf 100644
--- a/storage/connect/cmgoconn.cpp
+++ b/storage/connect/cmgoconn.cpp
@@ -150,6 +150,12 @@ void CMgoConn::mongo_init(bool init)
/***********************************************************************/
bool CMgoConn::Connect(PGLOBAL g)
{
+ if (!Pcg->Db_name || !Pcg->Coll_name) {
+ // This would crash in mongoc_client_get_collection
+ strcpy(g->Message, "Missing DB or collection name");
+ return true;
+ } // endif name
+
if (!IsInit)
#if defined(__WIN__)
__try {
diff --git a/storage/connect/tabrest.cpp b/storage/connect/tabrest.cpp
index 3ac86388ab2..9204043da62 100644
--- a/storage/connect/tabrest.cpp
+++ b/storage/connect/tabrest.cpp
@@ -24,6 +24,7 @@
#else // !__WIN__
#define __stdcall
#include <dlfcn.h> // dlopen(), dlclose(), dlsym() ...
+#include <libexplain/execlp.h>
#endif // !__WIN__
#endif // !REST_SOURCE
#define _OS_H_INCLUDED // Prevent os.h to be called
@@ -148,7 +149,6 @@ int Xcurl(PGLOBAL g, PCSZ Http, PCSZ Uri, PCSZ filename)
} // endif CreateProcess
#else // !__WIN__
char fn[600];
- int rcd;
pid_t pID = vfork();
sprintf(fn, "-o%s", filename);