Commit 2aefe0be authored by Olivier Bertrand's avatar Olivier Bertrand

- Fix crash when not specifying the collection for MongoDB

  modified:   storage/connect/cmgoconn.cpp

- Fix(?) Linux compile errors
  modified:   storage/connect/tabrest.cpp
parent caff19ad
...@@ -150,6 +150,12 @@ void CMgoConn::mongo_init(bool init) ...@@ -150,6 +150,12 @@ void CMgoConn::mongo_init(bool init)
/***********************************************************************/ /***********************************************************************/
bool CMgoConn::Connect(PGLOBAL g) 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 (!IsInit)
#if defined(__WIN__) #if defined(__WIN__)
__try { __try {
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#else // !__WIN__ #else // !__WIN__
#define __stdcall #define __stdcall
#include <dlfcn.h> // dlopen(), dlclose(), dlsym() ... #include <dlfcn.h> // dlopen(), dlclose(), dlsym() ...
#include <libexplain/execlp.h>
#endif // !__WIN__ #endif // !__WIN__
#endif // !REST_SOURCE #endif // !REST_SOURCE
#define _OS_H_INCLUDED // Prevent os.h to be called #define _OS_H_INCLUDED // Prevent os.h to be called
...@@ -148,7 +149,6 @@ int Xcurl(PGLOBAL g, PCSZ Http, PCSZ Uri, PCSZ filename) ...@@ -148,7 +149,6 @@ int Xcurl(PGLOBAL g, PCSZ Http, PCSZ Uri, PCSZ filename)
} // endif CreateProcess } // endif CreateProcess
#else // !__WIN__ #else // !__WIN__
char fn[600]; char fn[600];
int rcd;
pid_t pID = vfork(); pid_t pID = vfork();
sprintf(fn, "-o%s", filename); sprintf(fn, "-o%s", filename);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment