Commit df4b65b5 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

Fix various compiler/OS compatibility errors

parent 0139d40d
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
#define QUERY_REAP_FLAG 2 #define QUERY_REAP_FLAG 2
#ifndef HAVE_SETENV #ifndef HAVE_SETENV
#error implement our portable setenv replacement in mysys static int setenv(const char *name, const char *value, int overwrite)
#endif #endif
enum { enum {
...@@ -9672,3 +9672,18 @@ void dynstr_append_sorted(DYNAMIC_STRING* ds, DYNAMIC_STRING *ds_input) ...@@ -9672,3 +9672,18 @@ void dynstr_append_sorted(DYNAMIC_STRING* ds, DYNAMIC_STRING *ds_input)
delete_dynamic(&lines); delete_dynamic(&lines);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
#ifndef HAVE_SETENV
static int setenv(const char *name, const char *value, int overwrite)
{
size_t buflen= strlen(name) + strlen(value) + 2;
char *envvar= malloc(buflen);
if(!envvar)
return ENOMEM;
strcpy(envvar, name);
strcat(envvar, "=");
strcat(envvar, value);
putenv(envvar);
return 0;
}
#endif
...@@ -534,7 +534,7 @@ ...@@ -534,7 +534,7 @@
#cmakedefine strtok_r @strtok_r@ #cmakedefine strtok_r @strtok_r@
#cmakedefine strtoll @strtoll@ #cmakedefine strtoll @strtoll@
#cmakedefine strtoull @strtoull@ #cmakedefine strtoull @strtoull@
#ifdef _WIN32 #if (_MSC_VER > 1310)
#define HAVE_SETENV #define HAVE_SETENV
#define setenv(a,b,c) _putenv_s(a,b) #define setenv(a,b,c) _putenv_s(a,b)
#endif #endif
......
...@@ -284,9 +284,13 @@ IF(UNIX) ...@@ -284,9 +284,13 @@ IF(UNIX)
IF(NOT LIBM) IF(NOT LIBM)
MY_SEARCH_LIBS(__infinity m LIBM) MY_SEARCH_LIBS(__infinity m LIBM)
ENDIF() ENDIF()
IF(NOT LIBM)
MY_SEARCH_LIBS(rint m LIBM) IF(CMAKE_SYSTEM_NAME MATCHES "SunOS")
ENDIF() # On Solaris, use of intrinsics will screw the lib search logic
# Force using -lm, so rint etc are found.
SET(LIBM m)
ENDIF()
MY_SEARCH_LIBS(gethostbyname_r "nsl_r;nsl" LIBNSL) MY_SEARCH_LIBS(gethostbyname_r "nsl_r;nsl" LIBNSL)
MY_SEARCH_LIBS(bind "bind;socket" LIBBIND) MY_SEARCH_LIBS(bind "bind;socket" LIBBIND)
MY_SEARCH_LIBS(crypt crypt LIBCRYPT) MY_SEARCH_LIBS(crypt crypt LIBCRYPT)
......
...@@ -326,7 +326,7 @@ my_ulonglong find_set_from_flags(const TYPELIB *lib, uint default_name, ...@@ -326,7 +326,7 @@ my_ulonglong find_set_from_flags(const TYPELIB *lib, uint default_name,
my_ulonglong flags_to_set= 0, flags_to_clear= 0, res; my_ulonglong flags_to_set= 0, flags_to_clear= 0, res;
my_bool set_defaults= 0; my_bool set_defaults= 0;
*err_pos= 0; // No error yet *err_pos= 0; /* No error yet */
if (str != end) if (str != end)
{ {
const char *start= str; const char *start= str;
......
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