Updated old references to MAXSCALE_HOME
This commit is contained in:
@ -26,6 +26,7 @@
|
|||||||
#include <adminusers.h>
|
#include <adminusers.h>
|
||||||
#include <skygw_utils.h>
|
#include <skygw_utils.h>
|
||||||
#include <log_manager.h>
|
#include <log_manager.h>
|
||||||
|
#include <gwdirs.h>
|
||||||
|
|
||||||
/** Defined in log_manager.cc */
|
/** Defined in log_manager.cc */
|
||||||
extern int lm_enabled_logfiles_bitmask;
|
extern int lm_enabled_logfiles_bitmask;
|
||||||
@ -119,12 +120,7 @@ char fname[1024], *home;
|
|||||||
char uname[80], passwd[80];
|
char uname[80], passwd[80];
|
||||||
|
|
||||||
initialise();
|
initialise();
|
||||||
if ((home = getenv("MAXSCALE_HOME")) != NULL && strlen(home) < 1024){
|
sprintf(fname, "%s/passwd", get_cachedir());
|
||||||
sprintf(fname, "%s/etc/passwd", home);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
sprintf(fname, "/usr/local/mariadb-maxscale/etc/passwd");
|
|
||||||
}
|
|
||||||
if ((fp = fopen(fname, "r")) == NULL)
|
if ((fp = fopen(fname, "r")) == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
if ((rval = users_alloc()) == NULL)
|
if ((rval = users_alloc()) == NULL)
|
||||||
@ -155,12 +151,7 @@ FILE *fp;
|
|||||||
char fname[1024], *home, *cpasswd;
|
char fname[1024], *home, *cpasswd;
|
||||||
|
|
||||||
initialise();
|
initialise();
|
||||||
if ((home = getenv("MAXSCALE_HOME")) != NULL && strlen(home) < 1024){
|
sprintf(fname, "%s/passwd", get_cachedir());
|
||||||
sprintf(fname, "%s/etc/passwd", home);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
sprintf(fname, "/usr/local/mariadb-maxscale/etc/passwd");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (users == NULL)
|
if (users == NULL)
|
||||||
{
|
{
|
||||||
@ -253,15 +244,8 @@ char* admin_remove_user(
|
|||||||
/**
|
/**
|
||||||
* Open passwd file and remove user from the file.
|
* Open passwd file and remove user from the file.
|
||||||
*/
|
*/
|
||||||
if ((home = getenv("MAXSCALE_HOME")) != NULL &&
|
sprintf(fname, "%s/passwd", get_cachedir());
|
||||||
strnlen(home,PATH_MAX) < PATH_MAX &&
|
sprintf(fname_tmp, "%s/passwd_tmp", get_cachedir());
|
||||||
strnlen(home,PATH_MAX) > 0) {
|
|
||||||
sprintf(fname, "%s/etc/passwd", home);
|
|
||||||
sprintf(fname_tmp, "%s/etc/passwd_tmp", home);
|
|
||||||
} else {
|
|
||||||
sprintf(fname, "/usr/local/mariadb-maxscale/etc/passwd");
|
|
||||||
sprintf(fname_tmp, "/usr/local/mariadb-maxscale/etc/passwd_tmp");
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* Rewrite passwd file from memory.
|
* Rewrite passwd file from memory.
|
||||||
*/
|
*/
|
||||||
|
@ -105,17 +105,6 @@ WriteMemoryCallback(void *contents, size_t size, size_t nmemb, void *userp)
|
|||||||
return realsize;
|
return realsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* get_maxscale_home(void)
|
|
||||||
{
|
|
||||||
char* home = getenv("MAXSCALE_HOME");
|
|
||||||
if (home == NULL)
|
|
||||||
{
|
|
||||||
home = "/usr/local/mariadb-maxscale";
|
|
||||||
}
|
|
||||||
return home;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load the dynamic library related to a gateway module. The routine
|
* Load the dynamic library related to a gateway module. The routine
|
||||||
* will look for library files in the current directory,
|
* will look for library files in the current directory,
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include <secrets.h>
|
#include <secrets.h>
|
||||||
#include <skygw_utils.h>
|
#include <skygw_utils.h>
|
||||||
#include <log_manager.h>
|
#include <log_manager.h>
|
||||||
|
#include <gwdirs.h>
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int arg_count = 3;
|
int arg_count = 3;
|
||||||
@ -52,19 +53,20 @@ int main(int argc, char **argv)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(access("/var/log/maxscale/maxkeys/",F_OK) != 0)
|
||||||
|
{
|
||||||
|
if(mkdir("/var/log/maxscale/maxkeys/",0777) == -1)
|
||||||
|
{
|
||||||
|
if(errno != EEXIST)
|
||||||
|
{
|
||||||
|
fprintf(stderr,"Error: %d - %s",errno,strerror(errno));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
arg_vector[0] = strdup("logmanager");
|
arg_vector[0] = strdup("logmanager");
|
||||||
arg_vector[1] = strdup("-j");
|
arg_vector[1] = strdup("-j");
|
||||||
|
arg_vector[2] = strdup("/var/log/maxscale/maxkeys");
|
||||||
if ((home = getenv("MAXSCALE_HOME")) != NULL)
|
|
||||||
{
|
|
||||||
arg_vector[2] = (char*)malloc((strlen(home) + strlen("/log"))*sizeof(char));
|
|
||||||
sprintf(arg_vector[2],"%s/log",home);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
arg_vector[2] = strdup("/usr/local/mariadb-maxscale/log");
|
|
||||||
}
|
|
||||||
|
|
||||||
arg_vector[3] = NULL;
|
arg_vector[3] = NULL;
|
||||||
skygw_logmanager_init(arg_count,arg_vector);
|
skygw_logmanager_init(arg_count,arg_vector);
|
||||||
skygw_log_enable(LOGFILE_TRACE);
|
skygw_log_enable(LOGFILE_TRACE);
|
||||||
|
@ -68,7 +68,6 @@ extern void unload_all_modules();
|
|||||||
extern void printModules();
|
extern void printModules();
|
||||||
extern void dprintAllModules(DCB *);
|
extern void dprintAllModules(DCB *);
|
||||||
extern RESULTSET *moduleGetList();
|
extern RESULTSET *moduleGetList();
|
||||||
extern char *get_maxscale_home(void);
|
|
||||||
extern void module_feedback_send(void*);
|
extern void module_feedback_send(void*);
|
||||||
extern void moduleShowFeedbackReport(DCB *dcb);
|
extern void moduleShowFeedbackReport(DCB *dcb);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user