Commit 26e5ba4b authored by Olivier Bertrand's avatar Olivier Bertrand

- Fix Linux compile errors

  modified:   storage/connect/tabrest.cpp
  modified:   storage/connect/CMakeLists.txt

- Fix cmake error
 modified:   libmariadb/cmake/ConnectorName.cmake
parent d1b6cad0
...@@ -354,9 +354,6 @@ IF(CONNECT_WITH_REST) ...@@ -354,9 +354,6 @@ IF(CONNECT_WITH_REST)
##ELSE(NOT cpprestsdk_FOUND) ##ELSE(NOT cpprestsdk_FOUND)
## MESSAGE(STATUS "=====> cpprestsdk package not found") ## MESSAGE(STATUS "=====> cpprestsdk package not found")
# ENDIF (cpprestsdk_FOUND) # ENDIF (cpprestsdk_FOUND)
IF(UNIX)
SET(REST_LIBRARY -lexplain)
ENDIF(UNIX)
ENDIF(CONNECT_WITH_REST) ENDIF(CONNECT_WITH_REST)
# #
......
...@@ -24,11 +24,6 @@ ...@@ -24,11 +24,6 @@
#else // !__WIN__ #else // !__WIN__
#define __stdcall #define __stdcall
#include <dlfcn.h> // dlopen(), dlclose(), dlsym() ... #include <dlfcn.h> // dlopen(), dlclose(), dlsym() ...
#include <sys/types.h>
#include <unistd.h>
#include "stdio.h"
#include <sys/wait.h>
#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
...@@ -58,11 +53,6 @@ ...@@ -58,11 +53,6 @@
#define PUSH_WARNING(M) htrc(M) #define PUSH_WARNING(M) htrc(M)
#endif #endif
#if 0
#define popen _popen
#define pclose _pclose
#endif // 0
static XGETREST getRestFnc = NULL; static XGETREST getRestFnc = NULL;
static int Xcurl(PGLOBAL g, PCSZ Http, PCSZ Uri, PCSZ filename); static int Xcurl(PGLOBAL g, PCSZ Http, PCSZ Uri, PCSZ filename);
...@@ -146,30 +136,37 @@ int Xcurl(PGLOBAL g, PCSZ Http, PCSZ Uri, PCSZ filename) ...@@ -146,30 +136,37 @@ int Xcurl(PGLOBAL g, PCSZ Http, PCSZ Uri, PCSZ filename)
FILE *f= popen("command -v curl", "r"); FILE *f= popen("command -v curl", "r");
if (!f) { if (!f) {
strcpy(g->Message, "curl CLI not installed"); strcpy(g->Message, "Problem in allocating memory.");
return 1;
} else {
char temp_buff[50];
size_t len = fread(temp_buff,1, 50, f);
if(!len) {
strcpy(g->Message, "Curl not installed.");
return 1; return 1;
} else } else
pclose(f); pclose(f);
} // endif f
pID = vfork(); pID = vfork();
sprintf(fn, "-o%s", filename); sprintf(fn, "-o%s", filename);
if (pID == 0) { if (pID == 0) {
// Code executed by child process // Code executed by child process
execlp("curl", "curl", buf, fn, (char*)NULL); execlp("curl", "curl", buf, fn, (char*)NULL);
// If execlp() is successful, we should not reach this next line.
strcpy(g->Message, explain_execlp("curl", "curl", buf, fn, (char*)NULL)));
rc = 1;
exit(rc);
} // endif execlp
// If execlp() is successful, we should not reach this next line.
strcpy(g->Message, "I shouldn't be called after execlp from vfork()");
exit(1);
} else if (pID < 0) { } else if (pID < 0) {
// failed to fork // failed to fork
strcpy(g->Message, "Failed to fork"); strcpy(g->Message, "Failed to fork");
rc = 1; rc = 1;
} else { } else {
// Parent process // Parent process
wait(0); // Wait for the child to terminate wait(NULL); // Wait for the child to terminate
} // endif pID } // endif pID
#endif // !__WIN__ #endif // !__WIN__
......
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