Commit 97cf0053 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

Fix various compiler/OS compatibility errors

parent 4ce2f8b6
......@@ -73,7 +73,7 @@
#define QUERY_REAP_FLAG 2
#ifndef HAVE_SETENV
#error implement our portable setenv replacement in mysys
static int setenv(const char *name, const char *value, int overwrite)
#endif
enum {
......@@ -9672,3 +9672,18 @@ void dynstr_append_sorted(DYNAMIC_STRING* ds, DYNAMIC_STRING *ds_input)
delete_dynamic(&lines);
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 @@
#cmakedefine strtok_r @strtok_r@
#cmakedefine strtoll @strtoll@
#cmakedefine strtoull @strtoull@
#ifdef _WIN32
#if (_MSC_VER > 1310)
#define HAVE_SETENV
#define setenv(a,b,c) _putenv_s(a,b)
#endif
......
......@@ -284,9 +284,13 @@ IF(UNIX)
IF(NOT LIBM)
MY_SEARCH_LIBS(__infinity m LIBM)
ENDIF()
IF(NOT LIBM)
MY_SEARCH_LIBS(rint m LIBM)
ENDIF()
IF(CMAKE_SYSTEM_NAME MATCHES "SunOS")
# 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(bind "bind;socket" LIBBIND)
MY_SEARCH_LIBS(crypt crypt LIBCRYPT)
......
......@@ -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_bool set_defaults= 0;
*err_pos= 0; // No error yet
*err_pos= 0; /* No error yet */
if (str != end)
{
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