Commit 28b76afc authored by Olivier Bertrand's avatar Olivier Bertrand

- Fix(?) Linux compile errors

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

-fix MDEV-24794
 modified:   storage/connect/valblk.h
parent 2aefe0be
...@@ -354,6 +354,9 @@ IF(CONNECT_WITH_REST) ...@@ -354,6 +354,9 @@ 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,6 +24,10 @@ ...@@ -24,6 +24,10 @@
#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> #include <libexplain/execlp.h>
#endif // !__WIN__ #endif // !__WIN__
#endif // !REST_SOURCE #endif // !REST_SOURCE
...@@ -98,18 +102,6 @@ int Xcurl(PGLOBAL g, PCSZ Http, PCSZ Uri, PCSZ filename) ...@@ -98,18 +102,6 @@ int Xcurl(PGLOBAL g, PCSZ Http, PCSZ Uri, PCSZ filename)
int rc = 0; int rc = 0;
FILE *pipe; FILE *pipe;
if ((pipe = popen("curl --version", "r"))) {
if (trace(515))
while (fgets(buf, sizeof(buf), pipe)) {
htrc("%s", buf);
} // endwhile
pclose(pipe);
} else {
sprintf(g->Message, "curl not available, errno=%d", errno);
return 1;
} // endif pipe
if (strchr(filename, '"')) { if (strchr(filename, '"')) {
strcpy(g->Message, "Invalid file name"); strcpy(g->Message, "Invalid file name");
return 1; return 1;
...@@ -149,15 +141,25 @@ int Xcurl(PGLOBAL g, PCSZ Http, PCSZ Uri, PCSZ filename) ...@@ -149,15 +141,25 @@ int Xcurl(PGLOBAL g, PCSZ Http, PCSZ Uri, PCSZ filename)
} // endif CreateProcess } // endif CreateProcess
#else // !__WIN__ #else // !__WIN__
char fn[600]; char fn[600];
pid_t pID = vfork(); pid_t pID;
// Check if curl package is availabe by executing subprocess
FILE *f= popen("command -v curl", "r");
if (!f) {
strcpy(g->Message, "curl CLI not installed");
return 1;
} else
close(f);
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. // If execlp() is successful, we should not reach this next line.
strcpy(g->Message, explain_execlp()); strcpy(g->Message, explain_execlp("curl", "curl", buf, fn, (char*)NULL)));
rc = 1; rc = 1;
exit(rc); exit(rc);
} // endif execlp } // endif execlp
......
...@@ -69,7 +69,7 @@ class VALBLK : public BLOCK { ...@@ -69,7 +69,7 @@ class VALBLK : public BLOCK {
int GetPrec(void) {return Prec;} int GetPrec(void) {return Prec;}
void SetCheck(bool b) {Check = b;} void SetCheck(bool b) {Check = b;}
void MoveNull(int i, int j) void MoveNull(int i, int j)
{if (To_Nulls) To_Nulls[j] = To_Nulls[j];} {if (To_Nulls) To_Nulls[j] = To_Nulls[i];}
virtual void SetNull(int n, bool b) virtual void SetNull(int n, bool b)
{if (To_Nulls) {To_Nulls[n] = (b) ? '*' : 0;}} {if (To_Nulls) {To_Nulls[n] = (b) ? '*' : 0;}}
virtual bool IsNull(int n) {return To_Nulls && To_Nulls[n];} virtual bool IsNull(int n) {return To_Nulls && To_Nulls[n];}
......
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