Indentation and whitespace fixes.

There were many combinations of tab-width used so making the
indentation look right in the editor wasn't really possible.

The changes made:
- All tabs replaced with spaces.
- Indentation depth 4.
- , followed by space.
- Most binary operators (*, =, -) surrounded by one space.
- No space following ( or before ).
- Keywords follwed by 1 space.
This commit is contained in:
Johan Wikman
2015-10-29 15:07:30 +02:00
parent 1f22e2854b
commit b543f36a49

View File

@ -43,12 +43,12 @@
#define OPENSSL_THREAD_DEFINES #define OPENSSL_THREAD_DEFINES
#include <my_config.h> #include <my_config.h>
#include <openssl/opensslconf.h> #include <openssl/opensslconf.h>
#if defined(OPENSSL_THREADS) #if defined(OPENSSL_THREADS)
#define HAVE_OPENSSL_THREADS 1 #define HAVE_OPENSSL_THREADS 1
#else #else
#define HAVE_OPENSSL_THREADS 0 #define HAVE_OPENSSL_THREADS 0
#endif #endif
#include <ftw.h> #include <ftw.h>
#include <string.h> #include <string.h>
@ -139,10 +139,10 @@ static char* server_groups[] = {
}; };
/* The data directory we created for this gateway instance */ /* The data directory we created for this gateway instance */
static char datadir[PATH_MAX+1] = ""; static char datadir[PATH_MAX + 1] = "";
static bool datadir_defined = false; /*< If the datadir was already set */ static bool datadir_defined = false; /*< If the datadir was already set */
/* The data directory we created for this gateway instance */ /* The data directory we created for this gateway instance */
static char pidfile[PATH_MAX+1] = ""; static char pidfile[PATH_MAX + 1] = "";
static int pidfd = PIDFD_CLOSED; static int pidfd = PIDFD_CLOSED;
/** /**
@ -170,14 +170,14 @@ static struct option long_options[] = {
{"log", required_argument, 0, 'l'}, {"log", required_argument, 0, 'l'},
{"logdir", required_argument, 0, 'L'}, {"logdir", required_argument, 0, 'L'},
{"datadir", required_argument, 0, 'D'}, {"datadir", required_argument, 0, 'D'},
{"configdir",required_argument, 0, 'C'}, {"configdir", required_argument, 0, 'C'},
{"piddir",required_argument, 0, 'P'}, {"piddir", required_argument, 0, 'P'},
{"libdir",required_argument, 0, 'B'}, {"libdir", required_argument, 0, 'B'},
{"cachedir",required_argument, 0, 'A'}, {"cachedir", required_argument, 0, 'A'},
{"language",required_argument, 0, 'N'}, {"language", required_argument, 0, 'N'},
{"syslog", required_argument, 0, 's'}, {"syslog", required_argument, 0, 's'},
{"maxscalelog",required_argument,0,'S'}, {"maxscalelog", required_argument, 0, 'S'},
{"user",required_argument,0,'U'}, {"user", required_argument, 0, 'U'},
{"version", no_argument, 0, 'v'}, {"version", no_argument, 0, 'v'},
{"help", no_argument, 0, '?'}, {"help", no_argument, 0, '?'},
{"version-full", no_argument, 0, 'V'}, {"version-full", no_argument, 0, 'V'},
@ -215,7 +215,7 @@ static bool resolve_maxscale_conf_fname(
char* home_dir, char* home_dir,
char* cnf_file_arg); char* cnf_file_arg);
static char* check_dir_access(char* dirname,bool,bool); static char* check_dir_access(char* dirname, bool, bool);
static int set_user(); static int set_user();
bool pid_file_exists(); bool pid_file_exists();
void write_child_exit_code(int fd, int code); void write_child_exit_code(int fd, int code);
@ -223,9 +223,9 @@ void write_child_exit_code(int fd, int code);
static SPINLOCK* ssl_locks; static SPINLOCK* ssl_locks;
static void ssl_locking_function(int mode,int n,const char* file, int line) static void ssl_locking_function(int mode, int n, const char* file, int line)
{ {
if(mode & CRYPTO_LOCK) if (mode & CRYPTO_LOCK)
spinlock_acquire(&ssl_locks[n]); spinlock_acquire(&ssl_locks[n]);
else else
spinlock_release(&ssl_locks[n]); spinlock_release(&ssl_locks[n]);
@ -248,7 +248,7 @@ struct CRYPTO_dynlock_value
static struct CRYPTO_dynlock_value *ssl_create_dynlock(const char* file, int line) static struct CRYPTO_dynlock_value *ssl_create_dynlock(const char* file, int line)
{ {
struct CRYPTO_dynlock_value* lock = malloc(sizeof(struct CRYPTO_dynlock_value)); struct CRYPTO_dynlock_value* lock = malloc(sizeof(struct CRYPTO_dynlock_value));
if(lock) if (lock)
{ {
spinlock_init(&lock->lock); spinlock_init(&lock->lock);
} }
@ -262,9 +262,9 @@ static struct CRYPTO_dynlock_value *ssl_create_dynlock(const char* file, int lin
* @param file File name * @param file File name
* @param line Line number * @param line Line number
*/ */
static void ssl_lock_dynlock(int mode,struct CRYPTO_dynlock_value * n,const char* file, int line) static void ssl_lock_dynlock(int mode, struct CRYPTO_dynlock_value * n, const char* file, int line)
{ {
if(mode & CRYPTO_LOCK) if (mode & CRYPTO_LOCK)
{ {
spinlock_acquire(&n->lock); spinlock_acquire(&n->lock);
} }
@ -280,7 +280,7 @@ static void ssl_lock_dynlock(int mode,struct CRYPTO_dynlock_value * n,const char
* @param file File name * @param file File name
* @param line Line number * @param line Line number
*/ */
static void ssl_free_dynlock(struct CRYPTO_dynlock_value * n,const char* file, int line) static void ssl_free_dynlock(struct CRYPTO_dynlock_value * n, const char* file, int line)
{ {
free(n); free(n);
} }
@ -292,7 +292,7 @@ static void ssl_free_dynlock(struct CRYPTO_dynlock_value * n,const char* file, i
*/ */
static void maxscale_ssl_id(CRYPTO_THREADID* id) static void maxscale_ssl_id(CRYPTO_THREADID* id)
{ {
CRYPTO_THREADID_set_numeric(id,pthread_self()); CRYPTO_THREADID_set_numeric(id, pthread_self());
} }
#endif #endif
@ -352,41 +352,41 @@ sigchld_handler (int i)
int exit_status = 0; int exit_status = 0;
pid_t child = -1; pid_t child = -1;
if((child = wait(&exit_status)) == -1) if ((child = wait(&exit_status)) == -1)
{ {
char errbuf[STRERROR_BUFLEN]; char errbuf[STRERROR_BUFLEN];
skygw_log_write_flush(LE,"Error: failed to wait child process: %d %s", skygw_log_write_flush(LE, "Error: failed to wait child process: %d %s",
errno,strerror_r(errno, errbuf, sizeof(errbuf))); errno, strerror_r(errno, errbuf, sizeof(errbuf)));
} }
else else
{ {
if(WIFEXITED(exit_status)) if (WIFEXITED(exit_status))
{ {
skygw_log_write_flush(WEXITSTATUS(exit_status) != 0 ? LE : LT, skygw_log_write_flush(WEXITSTATUS(exit_status) != 0 ? LE : LT,
"Child process %d exited with status %d", "Child process %d exited with status %d",
child,WEXITSTATUS(exit_status)); child, WEXITSTATUS(exit_status));
} }
else if(WIFSIGNALED(exit_status)) else if (WIFSIGNALED(exit_status))
{ {
skygw_log_write_flush((LE|LT), skygw_log_write_flush((LE|LT),
"Child process %d was stopped by signal %d.", "Child process %d was stopped by signal %d.",
child,WTERMSIG(exit_status)); child, WTERMSIG(exit_status));
} }
else else
{ {
skygw_log_write_flush((LE|LT), skygw_log_write_flush((LE|LT),
"Child process %d did not exit normally. Exit status: %d", "Child process %d did not exit normally. Exit status: %d",
child,exit_status); child, exit_status);
} }
} }
} }
int fatal_handling = 0; int fatal_handling = 0;
static int signal_set (int sig, void (*handler)(int)); static int signal_set(int sig, void (*handler)(int));
static void static void
sigfatal_handler (int i) sigfatal_handler(int i)
{ {
if (fatal_handling) { if (fatal_handling) {
fprintf(stderr, "Fatal signal %d while backtracing\n", i); fprintf(stderr, "Fatal signal %d while backtracing\n", i);
@ -400,17 +400,17 @@ sigfatal_handler (int i)
LOGFILE_ERROR, LOGFILE_ERROR,
"Fatal: MaxScale "MAXSCALE_VERSION" received fatal signal %d. Attempting backtrace.", i); "Fatal: MaxScale "MAXSCALE_VERSION" received fatal signal %d. Attempting backtrace.", i);
skygw_log_write_flush(LE,"Commit ID: %s System name: %s " skygw_log_write_flush(LE, "Commit ID: %s System name: %s "
"Release string: %s Embedded library version: %s", "Release string: %s Embedded library version: %s",
maxscale_commit, cnf->sysname, cnf->release_string, cnf->version_string); maxscale_commit, cnf->sysname, cnf->release_string, cnf->version_string);
{ {
void *addrs[128]; void *addrs[128];
int n, count = backtrace(addrs, 128); int n, count = backtrace(addrs, 128);
char** symbols = backtrace_symbols( addrs, count ); char** symbols = backtrace_symbols(addrs, count);
if (symbols) { if (symbols) {
for( n = 0; n < count; n++ ) { for (n = 0; n < count; n++) {
skygw_log_write_flush( skygw_log_write_flush(
LOGFILE_ERROR, LOGFILE_ERROR,
" %s\n", symbols[n]); " %s\n", symbols[n]);
@ -445,7 +445,7 @@ sigfatal_handler (int i)
* @details (write detailed description here) * @details (write detailed description here)
* *
*/ */
static int signal_set (int sig, void (*handler)(int)) { static int signal_set(int sig, void (*handler)(int)) {
static struct sigaction sigact; static struct sigaction sigact;
static int err; static int err;
int rc = 0; int rc = 0;
@ -555,7 +555,7 @@ static bool file_write_header(
#if defined(LAPTOP_TEST) #if defined(LAPTOP_TEST)
struct timespec ts1; struct timespec ts1;
ts1.tv_sec = 0; ts1.tv_sec = 0;
ts1.tv_nsec = DISKWRITE_LATENCY*1000000; ts1.tv_nsec = DISKWRITE_LATENCY * 1000000;
#endif #endif
#if !defined(SS_DEBUG) #if !defined(SS_DEBUG)
@ -723,7 +723,7 @@ return_succp:
static char* check_dir_access( static char* check_dir_access(
char* dirname, bool rd, bool wr) char* dirname, bool rd, bool wr)
{ {
char errbuf[PATH_MAX*2]; char errbuf[PATH_MAX * 2];
char* errstr = NULL; char* errstr = NULL;
if (dirname == NULL) if (dirname == NULL)
@ -732,28 +732,28 @@ static char* check_dir_access(
goto retblock; goto retblock;
} }
if(access(dirname,F_OK) != 0) if (access(dirname, F_OK) != 0)
{ {
snprintf(errbuf,PATH_MAX*2-1,"Can't access '%s'.",dirname); snprintf(errbuf, PATH_MAX * 2 - 1, "Can't access '%s'.", dirname);
errbuf[PATH_MAX*2-1] = '\0'; errbuf[PATH_MAX * 2 - 1] = '\0';
errstr = strdup(errbuf); errstr = strdup(errbuf);
goto retblock; goto retblock;
} }
if (rd && !file_is_readable(dirname)) if (rd && !file_is_readable(dirname))
{ {
snprintf(errbuf,PATH_MAX*2-1,"MaxScale doesn't have read permission " snprintf(errbuf, PATH_MAX * 2 - 1, "MaxScale doesn't have read permission "
"to '%s'.",dirname); "to '%s'.", dirname);
errbuf[PATH_MAX*2-1] = '\0'; errbuf[PATH_MAX * 2 - 1] = '\0';
errstr = strdup(errbuf); errstr = strdup(errbuf);
goto retblock; goto retblock;
} }
if (wr && !file_is_writable(dirname)) if (wr && !file_is_writable(dirname))
{ {
snprintf(errbuf,PATH_MAX*2-1,"MaxScale doesn't have write permission " snprintf(errbuf, PATH_MAX * 2 - 1, "MaxScale doesn't have write permission "
"to '%s'.",dirname); "to '%s'.", dirname);
errbuf[PATH_MAX*2-1] = '\0'; errbuf[PATH_MAX * 2 - 1] = '\0';
errstr = strdup(errbuf); errstr = strdup(errbuf);
goto retblock; goto retblock;
} }
@ -1105,12 +1105,12 @@ int main(int argc, char **argv)
sigemptyset(&sigpipe_mask); sigemptyset(&sigpipe_mask);
sigaddset(&sigpipe_mask, SIGPIPE); sigaddset(&sigpipe_mask, SIGPIPE);
progname = *argv; progname = *argv;
snprintf(datadir,PATH_MAX, "%s", default_datadir); snprintf(datadir, PATH_MAX, "%s", default_datadir);
datadir[PATH_MAX] = '\0'; datadir[PATH_MAX] = '\0';
#if defined(FAKE_CODE) #if defined(FAKE_CODE)
memset(conn_open, 0, sizeof(bool)*10240); memset(conn_open, 0, sizeof(bool) * 10240);
memset(dcb_fake_write_errno, 0, sizeof(unsigned char)*10240); memset(dcb_fake_write_errno, 0, sizeof(unsigned char) * 10240);
memset(dcb_fake_write_ev, 0, sizeof(__int32_t)*10240); memset(dcb_fake_write_ev, 0, sizeof(__int32_t) * 10240);
fail_next_backend_fd = false; fail_next_backend_fd = false;
fail_next_client_fd = false; fail_next_client_fd = false;
fail_next_accept = 0; fail_next_accept = 0;
@ -1121,7 +1121,7 @@ int main(int argc, char **argv)
* Register functions which are called at exit except libmysqld-related, * Register functions which are called at exit except libmysqld-related,
* which must be registered later to avoid ordering issues. * which must be registered later to avoid ordering issues.
*/ */
for (i=0; exitfunp[i] != NULL; i++) for (i = 0; exitfunp[i] != NULL; i++)
{ {
l = atexit(*exitfunp); l = atexit(*exitfunp);
@ -1196,7 +1196,7 @@ int main(int argc, char **argv)
break; break;
case 'L': case 'L':
if(handle_path_arg(&tmp_path,optarg,NULL,true,false)) if (handle_path_arg(&tmp_path, optarg, NULL, true, false))
{ {
set_logdir(tmp_path); set_logdir(tmp_path);
} }
@ -1206,7 +1206,7 @@ int main(int argc, char **argv)
} }
break; break;
case 'N': case 'N':
if(handle_path_arg(&tmp_path,optarg,NULL,true,false)) if (handle_path_arg(&tmp_path, optarg, NULL, true, false))
{ {
set_langdir(tmp_path); set_langdir(tmp_path);
} }
@ -1216,7 +1216,7 @@ int main(int argc, char **argv)
} }
break; break;
case 'P': case 'P':
if(handle_path_arg(&tmp_path,optarg,NULL,true,true)) if (handle_path_arg(&tmp_path, optarg, NULL, true, true))
{ {
set_piddir(tmp_path); set_piddir(tmp_path);
} }
@ -1226,13 +1226,13 @@ int main(int argc, char **argv)
} }
break; break;
case 'D': case 'D':
snprintf(datadir,PATH_MAX,"%s",optarg); snprintf(datadir, PATH_MAX, "%s", optarg);
datadir[PATH_MAX] = '\0'; datadir[PATH_MAX] = '\0';
set_datadir(strdup(optarg)); set_datadir(strdup(optarg));
datadir_defined = true; datadir_defined = true;
break; break;
case 'C': case 'C':
if(handle_path_arg(&tmp_path,optarg,NULL,true,false)) if (handle_path_arg(&tmp_path, optarg, NULL, true, false))
{ {
set_configdir(tmp_path); set_configdir(tmp_path);
} }
@ -1242,7 +1242,7 @@ int main(int argc, char **argv)
} }
break; break;
case 'B': case 'B':
if(handle_path_arg(&tmp_path,optarg,NULL,true,false)) if (handle_path_arg(&tmp_path, optarg, NULL, true, false))
{ {
set_libdir(tmp_path); set_libdir(tmp_path);
} }
@ -1252,7 +1252,7 @@ int main(int argc, char **argv)
} }
break; break;
case 'A': case 'A':
if(handle_path_arg(&tmp_path,optarg,NULL,true,true)) if (handle_path_arg(&tmp_path, optarg, NULL, true, true))
{ {
set_cachedir(tmp_path); set_cachedir(tmp_path);
} }
@ -1263,11 +1263,11 @@ int main(int argc, char **argv)
break; break;
case 'S': case 'S':
{ {
char* tok = strstr(optarg,"="); char* tok = strstr(optarg, "=");
if(tok) if (tok)
{ {
tok++; tok++;
if(tok) if (tok)
*maxscalelog_enabled = config_truth_value(tok); *maxscalelog_enabled = config_truth_value(tok);
} }
else else
@ -1278,11 +1278,11 @@ int main(int argc, char **argv)
break; break;
case 's': case 's':
{ {
char* tok = strstr(optarg,"="); char* tok = strstr(optarg, "=");
if(tok) if (tok)
{ {
tok++; tok++;
if(tok) if (tok)
*syslog_enabled = config_truth_value(tok); *syslog_enabled = config_truth_value(tok);
} }
else else
@ -1292,7 +1292,7 @@ int main(int argc, char **argv)
} }
break; break;
case 'U': case 'U':
if(set_user(optarg) != 0) if (set_user(optarg) != 0)
{ {
succp = false; succp = false;
} }
@ -1330,9 +1330,10 @@ int main(int argc, char **argv)
} }
else else
{ {
if(pipe(daemon_pipe) == -1) if (pipe(daemon_pipe) == -1)
{ {
fprintf(stderr,"Error: Failed to create pipe for inter-process communication: %d %s",errno,strerror(errno)); fprintf(stderr, "Error: Failed to create pipe for inter-process communication: %d %s",
errno, strerror(errno));
rc = MAXSCALE_INTERNALERROR; rc = MAXSCALE_INTERNALERROR;
goto return_main; goto return_main;
} }
@ -1474,19 +1475,19 @@ int main(int argc, char **argv)
* the parent process of its exit status. */ * the parent process of its exit status. */
parent_process = gw_daemonize(); parent_process = gw_daemonize();
if(parent_process) if (parent_process)
{ {
close(daemon_pipe[1]); close(daemon_pipe[1]);
int nread = read(daemon_pipe[0],(void*)&child_status,sizeof(int)); int nread = read(daemon_pipe[0], (void*)&child_status, sizeof(int));
close(daemon_pipe[0]); close(daemon_pipe[0]);
if(nread == -1) if (nread == -1)
{ {
char* logerr = "Failed to read data from child process pipe."; char* logerr = "Failed to read data from child process pipe.";
print_log_n_stderr(true, true, logerr, logerr, errno); print_log_n_stderr(true, true, logerr, logerr, errno);
exit(MAXSCALE_INTERNALERROR); exit(MAXSCALE_INTERNALERROR);
} }
else if(nread == 0) else if (nread == 0)
{ {
/** Child process has exited or closed write pipe */ /** Child process has exited or closed write pipe */
char* logerr = "No data read from child process pipe."; char* logerr = "No data read from child process pipe.";
@ -1612,7 +1613,7 @@ int main(int argc, char **argv)
} }
/** OpenSSL initialization */ /** OpenSSL initialization */
if(!HAVE_OPENSSL_THREADS) if (!HAVE_OPENSSL_THREADS)
{ {
char* logerr = "OpenSSL library does not support multi-threading"; char* logerr = "OpenSSL library does not support multi-threading";
print_log_n_stderr(true, true, logerr, logerr, eno); print_log_n_stderr(true, true, logerr, logerr, eno);
@ -1624,7 +1625,7 @@ int main(int argc, char **argv)
OPENSSL_add_all_algorithms_noconf(); OPENSSL_add_all_algorithms_noconf();
int numlocks = CRYPTO_num_locks(); int numlocks = CRYPTO_num_locks();
if((ssl_locks = malloc(sizeof(SPINLOCK)*(numlocks + 1))) == NULL) if ((ssl_locks = malloc(sizeof(SPINLOCK) * (numlocks + 1))) == NULL)
{ {
char* logerr = "Memory allocation failed"; char* logerr = "Memory allocation failed";
print_log_n_stderr(true, true, logerr, logerr, eno); print_log_n_stderr(true, true, logerr, logerr, eno);
@ -1632,7 +1633,7 @@ int main(int argc, char **argv)
goto return_main; goto return_main;
} }
for(i = 0;i<numlocks + 1;i++) for (i = 0;i<numlocks + 1;i++)
spinlock_init(&ssl_locks[i]); spinlock_init(&ssl_locks[i]);
CRYPTO_set_locking_callback(ssl_locking_function); CRYPTO_set_locking_callback(ssl_locking_function);
CRYPTO_set_dynlock_create_callback(ssl_create_dynlock); CRYPTO_set_dynlock_create_callback(ssl_create_dynlock);
@ -1662,10 +1663,10 @@ int main(int argc, char **argv)
* read accessibility. * read accessibility.
*/ */
char pathbuf[PATH_MAX+1]; char pathbuf[PATH_MAX+1];
snprintf(pathbuf,PATH_MAX,"%s",get_configdir()); snprintf(pathbuf, PATH_MAX, "%s", get_configdir());
pathbuf[PATH_MAX] = '\0'; pathbuf[PATH_MAX] = '\0';
if(pathbuf[strlen(pathbuf)-1] != '/') if (pathbuf[strlen(pathbuf) - 1] != '/')
strcat(pathbuf,"/"); strcat(pathbuf, "/");
if (!resolve_maxscale_conf_fname(&cnf_file_path, pathbuf, cnf_file_arg)) if (!resolve_maxscale_conf_fname(&cnf_file_path, pathbuf, cnf_file_arg))
{ {
@ -1673,14 +1674,14 @@ int main(int argc, char **argv)
goto return_main; goto return_main;
} }
if((ini_rval = ini_parse(cnf_file_path, cnf_preparser,NULL)) != 0) if ((ini_rval = ini_parse(cnf_file_path, cnf_preparser, NULL)) != 0)
{ {
char errorbuffer[STRING_BUFFER_SIZE]; char errorbuffer[STRING_BUFFER_SIZE];
if(ini_rval > 0) if (ini_rval > 0)
snprintf(errorbuffer, sizeof(errorbuffer), snprintf(errorbuffer, sizeof(errorbuffer),
"Error: Failed to pre-parse configuration file. Error on line %d.", ini_rval); "Error: Failed to pre-parse configuration file. Error on line %d.", ini_rval);
else if(ini_rval == -1) else if (ini_rval == -1)
snprintf(errorbuffer, sizeof(errorbuffer), snprintf(errorbuffer, sizeof(errorbuffer),
"Error: Failed to pre-parse configuration file. Failed to open file."); "Error: Failed to pre-parse configuration file. Failed to open file.");
else else
@ -1688,7 +1689,7 @@ int main(int argc, char **argv)
"Error: Failed to pre-parse configuration file. Memory allocation failed."); "Error: Failed to pre-parse configuration file. Memory allocation failed.");
skygw_log_write(LE, errorbuffer); skygw_log_write(LE, errorbuffer);
if(!daemon_mode) if (!daemon_mode)
{ {
strncat(errorbuffer, "\n", STRING_BUFFER_SIZE); strncat(errorbuffer, "\n", STRING_BUFFER_SIZE);
fprintf(stderr, "%s", errorbuffer); fprintf(stderr, "%s", errorbuffer);
@ -1700,7 +1701,7 @@ int main(int argc, char **argv)
/** Use the cache dir for the mysql folder of the embedded library */ /** Use the cache dir for the mysql folder of the embedded library */
snprintf(mysql_home,PATH_MAX, "%s/mysql", get_cachedir()); snprintf(mysql_home, PATH_MAX, "%s/mysql", get_cachedir());
mysql_home[PATH_MAX] = '\0'; mysql_home[PATH_MAX] = '\0';
setenv("MYSQL_HOME", mysql_home, 1); setenv("MYSQL_HOME", mysql_home, 1);
@ -1716,7 +1717,7 @@ int main(int argc, char **argv)
char *argv[8]; char *argv[8];
bool succp; bool succp;
if(mkdir(get_logdir(),0777) != 0 && errno != EEXIST) if (mkdir(get_logdir(), 0777) != 0 && errno != EEXIST)
{ {
fprintf(stderr, fprintf(stderr,
"Error: Cannot create log directory: %s\n", "Error: Cannot create log directory: %s\n",
@ -1728,12 +1729,12 @@ int main(int argc, char **argv)
argv[1] = "-j"; argv[1] = "-j";
argv[2] = get_logdir(); argv[2] = get_logdir();
if(!(*syslog_enabled)) if (!(*syslog_enabled))
{ {
printf("Syslog logging is disabled.\n"); printf("Syslog logging is disabled.\n");
} }
if(!(*maxscalelog_enabled)) if (!(*maxscalelog_enabled))
{ {
printf("MaxScale logging is disabled.\n"); printf("MaxScale logging is disabled.\n");
} }
@ -1774,11 +1775,11 @@ int main(int argc, char **argv)
* machine. * machine.
*/ */
snprintf(datadir,PATH_MAX, "%s", get_datadir()); snprintf(datadir, PATH_MAX, "%s", get_datadir());
datadir[PATH_MAX] = '\0'; datadir[PATH_MAX] = '\0';
if(mkdir(datadir, 0777) != 0){ if (mkdir(datadir, 0777) != 0){
if(errno != EEXIST){ if (errno != EEXIST){
char errbuf[STRERROR_BUFLEN]; char errbuf[STRERROR_BUFLEN];
fprintf(stderr, fprintf(stderr,
"Error: Cannot create data directory '%s': %d %s\n", "Error: Cannot create data directory '%s': %d %s\n",
@ -1787,11 +1788,11 @@ int main(int argc, char **argv)
} }
} }
snprintf(datadir,PATH_MAX, "%s/data%d", get_datadir(), getpid()); snprintf(datadir, PATH_MAX, "%s/data%d", get_datadir(), getpid());
if(mkdir(datadir, 0777) != 0){ if (mkdir(datadir, 0777) != 0){
if(errno != EEXIST){ if (errno != EEXIST){
char errbuf[STRERROR_BUFLEN]; char errbuf[STRERROR_BUFLEN];
fprintf(stderr, fprintf(stderr,
"Error: Cannot create data directory '%s': %d %s\n", "Error: Cannot create data directory '%s': %d %s\n",
@ -1931,7 +1932,7 @@ int main(int argc, char **argv)
getpid()))); getpid())));
/** Check if a MaxScale process is already running */ /** Check if a MaxScale process is already running */
if(pid_file_exists()) if (pid_file_exists())
{ {
/** There is a process with the PID of the maxscale.pid file running. /** There is a process with the PID of the maxscale.pid file running.
* Assuming that this is an already running MaxScale process, we * Assuming that this is an already running MaxScale process, we
@ -1941,7 +1942,7 @@ int main(int argc, char **argv)
} }
/* Write process pid into MaxScale pidfile */ /* Write process pid into MaxScale pidfile */
if(write_pid_file() != 0) if (write_pid_file() != 0)
{ {
rc = MAXSCALE_ALREADYRUNNING; rc = MAXSCALE_ALREADYRUNNING;
goto return_main; goto return_main;
@ -1999,7 +2000,7 @@ int main(int argc, char **argv)
* Successful start, notify the parent process that it can exit. * Successful start, notify the parent process that it can exit.
*/ */
ss_dassert(rc == MAXSCALE_SHUTDOWN); ss_dassert(rc == MAXSCALE_SHUTDOWN);
if(daemon_mode) if (daemon_mode)
write_child_exit_code(daemon_pipe[1], rc); write_child_exit_code(daemon_pipe[1], rc);
MaxScaleStarted = time(0); MaxScaleStarted = time(0);
@ -2041,7 +2042,7 @@ int main(int argc, char **argv)
return_main: return_main:
if(daemon_mode && rc != MAXSCALE_SHUTDOWN) if (daemon_mode && rc != MAXSCALE_SHUTDOWN)
{ {
/** Notify the parent process that an error has occurred */ /** Notify the parent process that an error has occurred */
write_child_exit_code(daemon_pipe[1], rc); write_child_exit_code(daemon_pipe[1], rc);
@ -2090,7 +2091,7 @@ static void log_flush_cb(
struct timespec ts1; struct timespec ts1;
ts1.tv_sec = timeout_ms/1000; ts1.tv_sec = timeout_ms/1000;
ts1.tv_nsec = (timeout_ms%1000)*1000000; ts1.tv_nsec = (timeout_ms%1000) * 1000000;
LOGIF(LM, (skygw_log_write(LOGFILE_MESSAGE, LOGIF(LM, (skygw_log_write(LOGFILE_MESSAGE,
"Started MaxScale log flusher."))); "Started MaxScale log flusher.")));
@ -2107,13 +2108,13 @@ static void log_flush_cb(
static void unlock_pidfile() static void unlock_pidfile()
{ {
if(pidfd != PIDFD_CLOSED) if (pidfd != PIDFD_CLOSED)
{ {
if(flock(pidfd,LOCK_UN|LOCK_NB) != 0) if (flock(pidfd, LOCK_UN|LOCK_NB) != 0)
{ {
char logbuf[STRING_BUFFER_SIZE + PATH_MAX]; char logbuf[STRING_BUFFER_SIZE + PATH_MAX];
char* logerr = "Failed to unlock PID file '%s'."; char* logerr = "Failed to unlock PID file '%s'.";
snprintf(logbuf,sizeof(logbuf),logerr,pidfile); snprintf(logbuf, sizeof(logbuf), logerr, pidfile);
print_log_n_stderr(true, true, logbuf, logbuf, errno); print_log_n_stderr(true, true, logbuf, logbuf, errno);
} }
close(pidfd); close(pidfd);
@ -2153,29 +2154,29 @@ bool pid_file_exists()
pid_t pid; pid_t pid;
bool lock_failed = false; bool lock_failed = false;
snprintf(pathbuf, PATH_MAX, "%s/maxscale.pid",get_piddir()); snprintf(pathbuf, PATH_MAX, "%s/maxscale.pid", get_piddir());
pathbuf[PATH_MAX] = '\0'; pathbuf[PATH_MAX] = '\0';
if(access(pathbuf,F_OK) != 0) if (access(pathbuf, F_OK) != 0)
return false; return false;
if(access(pathbuf,R_OK) == 0) if (access(pathbuf, R_OK) == 0)
{ {
int fd, b; int fd, b;
if((fd = open(pathbuf, O_RDWR)) == -1) if ((fd = open(pathbuf, O_RDWR)) == -1)
{ {
char* logerr = "Failed to open PID file '%s'."; char* logerr = "Failed to open PID file '%s'.";
snprintf(logbuf,sizeof(logbuf),logerr,pathbuf); snprintf(logbuf, sizeof(logbuf), logerr, pathbuf);
print_log_n_stderr(true, true, logbuf, logbuf, errno); print_log_n_stderr(true, true, logbuf, logbuf, errno);
return true; return true;
} }
if(flock(fd,LOCK_EX|LOCK_NB)) if (flock(fd, LOCK_EX|LOCK_NB))
{ {
if(errno != EWOULDBLOCK) if (errno != EWOULDBLOCK)
{ {
char* logerr = "Failed to lock PID file '%s'."; char* logerr = "Failed to lock PID file '%s'.";
snprintf(logbuf,sizeof(logbuf),logerr,pathbuf); snprintf(logbuf, sizeof(logbuf), logerr, pathbuf);
print_log_n_stderr(true, true, logbuf, logbuf, errno); print_log_n_stderr(true, true, logbuf, logbuf, errno);
close(fd); close(fd);
return true; return true;
@ -2184,53 +2185,55 @@ bool pid_file_exists()
} }
pidfd = fd; pidfd = fd;
b = read(fd,pidbuf,sizeof(pidbuf)); b = read(fd, pidbuf, sizeof(pidbuf));
if(b == -1) if (b == -1)
{ {
char* logerr = "Failed to read from PID file '%s'."; char* logerr = "Failed to read from PID file '%s'.";
snprintf(logbuf,sizeof(logbuf),logerr,pathbuf); snprintf(logbuf, sizeof(logbuf), logerr, pathbuf);
print_log_n_stderr(true, true, logbuf, logbuf, errno); print_log_n_stderr(true, true, logbuf, logbuf, errno);
unlock_pidfile(); unlock_pidfile();
return true; return true;
} }
else if(b == 0) else if (b == 0)
{ {
/** Empty file */ /** Empty file */
char* logerr = "PID file read from '%s'. File was empty.\n" char* logerr = "PID file read from '%s'. File was empty.\n"
"If the file is the correct PID file and no other MaxScale processes " "If the file is the correct PID file and no other MaxScale processes "
"are running, please remove it manually and start MaxScale again."; "are running, please remove it manually and start MaxScale again.";
snprintf(logbuf,sizeof(logbuf),logerr,pathbuf); snprintf(logbuf, sizeof(logbuf), logerr, pathbuf);
print_log_n_stderr(true, true, logbuf, logbuf, errno); print_log_n_stderr(true, true, logbuf, logbuf, errno);
unlock_pidfile(); unlock_pidfile();
return true; return true;
} }
pidbuf[b < sizeof(pidbuf) ? b : sizeof(pidbuf) - 1] = '\0'; pidbuf[b < sizeof(pidbuf) ? b : sizeof(pidbuf) - 1] = '\0';
pid = strtol(pidbuf,NULL,0); pid = strtol(pidbuf, NULL, 0);
if(pid < 1) if (pid < 1)
{ {
/** Bad PID */ /** Bad PID */
char* logerr = "PID file read from '%s'. File contents not valid.\n" char* logerr = "PID file read from '%s'. File contents not valid.\n"
"If the file is the correct PID file and no other MaxScale processes " "If the file is the correct PID file and no other MaxScale processes "
"are running, please remove it manually and start MaxScale again."; "are running, please remove it manually and start MaxScale again.";
snprintf(logbuf,sizeof(logbuf),logerr,pathbuf); snprintf(logbuf, sizeof(logbuf), logerr, pathbuf);
print_log_n_stderr(true, true, logbuf, logbuf, errno); print_log_n_stderr(true, true, logbuf, logbuf, errno);
unlock_pidfile(); unlock_pidfile();
return true; return true;
} }
if(kill(pid,0) == -1) if (kill(pid, 0) == -1)
{ {
if(errno == ESRCH) if (errno == ESRCH)
{ {
/** no such process, old PID file */ /** no such process, old PID file */
if(lock_failed) if (lock_failed)
{ {
char* logerr = "Locking the PID file '%s' failed. Read PID from file and no process found with PID %d. " char* logerr =
"Locking the PID file '%s' failed. "
"Read PID from file and no process found with PID %d. "
"Confirm that no other process holds the lock on the PID file."; "Confirm that no other process holds the lock on the PID file.";
snprintf(logbuf,sizeof(logbuf),logerr,pathbuf,pid); snprintf(logbuf, sizeof(logbuf), logerr, pathbuf, pid);
print_log_n_stderr(true, true, logbuf, logbuf, 0); print_log_n_stderr(true, true, logbuf, logbuf, 0);
close(fd); close(fd);
} }
@ -2239,16 +2242,18 @@ bool pid_file_exists()
else else
{ {
char* logerr = "Failed to check the existence of process %d read from file '%s'"; char* logerr = "Failed to check the existence of process %d read from file '%s'";
snprintf(logbuf,sizeof(logbuf),logerr,pid,pathbuf); snprintf(logbuf, sizeof(logbuf), logerr, pid, pathbuf);
print_log_n_stderr(true, true, logbuf, logbuf, errno); print_log_n_stderr(true, true, logbuf, logbuf, errno);
unlock_pidfile(); unlock_pidfile();
} }
} }
else else
{ {
char* logerr = "MaxScale is already running. Process id: %d. " char* logerr =
"Use another location for the PID file to run multiple instances of MaxScale on the same machine."; "MaxScale is already running. Process id: %d. "
snprintf(logbuf,sizeof(logbuf),logerr,pid); "Use another location for the PID file to run multiple "
"instances of MaxScale on the same machine.";
snprintf(logbuf, sizeof(logbuf), logerr, pid);
print_log_n_stderr(true, true, logbuf, logbuf, 0); print_log_n_stderr(true, true, logbuf, logbuf, 0);
unlock_pidfile(); unlock_pidfile();
} }
@ -2257,7 +2262,7 @@ bool pid_file_exists()
{ {
char* logerr = "Cannot open PID file '%s', no read permissions. " char* logerr = "Cannot open PID file '%s', no read permissions. "
"Please confirm that the user running MaxScale has read permissions on the file."; "Please confirm that the user running MaxScale has read permissions on the file.";
snprintf(logbuf,sizeof(logbuf),logerr,pathbuf); snprintf(logbuf, sizeof(logbuf), logerr, pathbuf);
print_log_n_stderr(true, true, logbuf, logbuf, errno); print_log_n_stderr(true, true, logbuf, logbuf, errno);
} }
return true; return true;
@ -2275,30 +2280,32 @@ static int write_pid_file() {
char logbuf[STRING_BUFFER_SIZE + PATH_MAX]; char logbuf[STRING_BUFFER_SIZE + PATH_MAX];
char pidstr[STRING_BUFFER_SIZE]; char pidstr[STRING_BUFFER_SIZE];
snprintf(pidfile, PATH_MAX, "%s/maxscale.pid",get_piddir()); snprintf(pidfile, PATH_MAX, "%s/maxscale.pid", get_piddir());
if(pidfd == PIDFD_CLOSED) if (pidfd == PIDFD_CLOSED)
{ {
int fd = -1; int fd = -1;
fd = open(pidfile, O_WRONLY | O_CREAT, 0777); fd = open(pidfile, O_WRONLY | O_CREAT, 0777);
if (fd == -1) { if (fd == -1) {
char* logerr = "Failed to open PID file '%s'."; char* logerr = "Failed to open PID file '%s'.";
snprintf(logbuf,sizeof(logbuf),logerr,pidfile); snprintf(logbuf, sizeof(logbuf), logerr, pidfile);
print_log_n_stderr(true, true, logbuf, logbuf, errno); print_log_n_stderr(true, true, logbuf, logbuf, errno);
return -1; return -1;
} }
if(flock(fd,LOCK_EX|LOCK_NB)) if (flock(fd, LOCK_EX|LOCK_NB))
{ {
if(errno == EWOULDBLOCK) if (errno == EWOULDBLOCK)
{ {
snprintf(logbuf,sizeof(logbuf),"Failed to lock PID file '%s', another process is holding a lock on it. " snprintf(logbuf, sizeof(logbuf),
"Please confirm that no other MaxScale process is using the same PID file location.",pidfile); "Failed to lock PID file '%s', another process is holding a lock on it. "
"Please confirm that no other MaxScale process is using the same "
"PID file location.", pidfile);
} }
else else
{ {
snprintf(logbuf,sizeof(logbuf),"Failed to lock PID file '%s'.",pidfile); snprintf(logbuf, sizeof(logbuf), "Failed to lock PID file '%s'.", pidfile);
} }
print_log_n_stderr(true, true, logbuf, logbuf, errno); print_log_n_stderr(true, true, logbuf, logbuf, errno);
close(fd); close(fd);
@ -2310,17 +2317,17 @@ static int write_pid_file() {
/* truncate pidfile content */ /* truncate pidfile content */
if (ftruncate(pidfd, 0)) { if (ftruncate(pidfd, 0)) {
char* logerr = "MaxScale failed to truncate PID file '%s'."; char* logerr = "MaxScale failed to truncate PID file '%s'.";
snprintf(logbuf,sizeof(logbuf),logerr,pidfile); snprintf(logbuf, sizeof(logbuf), logerr, pidfile);
print_log_n_stderr(true, true, logbuf, logbuf, errno); print_log_n_stderr(true, true, logbuf, logbuf, errno);
unlock_pidfile(); unlock_pidfile();
return -1; return -1;
} }
snprintf(pidstr, sizeof(pidstr)-1, "%d", getpid()); snprintf(pidstr, sizeof(pidstr) - 1, "%d", getpid());
if (pwrite(pidfd, pidstr, strlen(pidstr), 0) != (ssize_t)strlen(pidstr)) { if (pwrite(pidfd, pidstr, strlen(pidstr), 0) != (ssize_t)strlen(pidstr)) {
char* logerr = "MaxScale failed to write into PID file '%s'."; char* logerr = "MaxScale failed to write into PID file '%s'.";
snprintf(logbuf,sizeof(logbuf),logerr,pidfile); snprintf(logbuf, sizeof(logbuf), logerr, pidfile);
print_log_n_stderr(true, true, logbuf, logbuf, errno); print_log_n_stderr(true, true, logbuf, logbuf, errno);
unlock_pidfile(); unlock_pidfile();
return -1; return -1;
@ -2342,27 +2349,27 @@ bool handle_path_arg(char** dest, char* path, char* arg, bool rd, bool wr)
char* errstr; char* errstr;
bool rval = false; bool rval = false;
if(path == NULL && arg == NULL) if (path == NULL && arg == NULL)
return rval; return rval;
if(path) if (path)
{ {
snprintf(pathbuffer,PATH_MAX,"%s",path); snprintf(pathbuffer, PATH_MAX, "%s", path);
if(pathbuffer[strlen(path) - 1] != '/') if (pathbuffer[strlen(path) - 1] != '/')
{ {
strcat(pathbuffer,"/"); strcat(pathbuffer, "/");
} }
if(arg && strlen(pathbuffer) + strlen(arg) + 1 < PATH_MAX) if (arg && strlen(pathbuffer) + strlen(arg) + 1 < PATH_MAX)
strcat(pathbuffer,arg); strcat(pathbuffer, arg);
if((errstr = check_dir_access(pathbuffer,rd,wr)) == NULL) if ((errstr = check_dir_access(pathbuffer, rd, wr)) == NULL)
{ {
*dest = strdup(pathbuffer); *dest = strdup(pathbuffer);
rval = true; rval = true;
} }
else else
{ {
print_log_n_stderr(true,true,errstr,errstr,0); print_log_n_stderr(true, true, errstr, errstr, 0);
free(errstr); free(errstr);
errstr = NULL; errstr = NULL;
} }
@ -2400,13 +2407,13 @@ static int cnf_preparser(void* data, const char* section, const char* name, cons
char *tmp; char *tmp;
/** These are read from the configuration file. These will not override /** These are read from the configuration file. These will not override
* command line parameters but will override default values. */ * command line parameters but will override default values. */
if(strcasecmp(section,"maxscale") == 0) if (strcasecmp(section, "maxscale") == 0)
{ {
if(strcmp(name, "logdir") == 0) if (strcmp(name, "logdir") == 0)
{ {
if(strcmp(get_logdir(),default_logdir) == 0) if (strcmp(get_logdir(), default_logdir) == 0)
{ {
if(handle_path_arg(&tmp,(char*)value,NULL,true,true)) if (handle_path_arg(&tmp, (char*)value, NULL, true, true))
{ {
set_logdir(tmp); set_logdir(tmp);
} }
@ -2416,11 +2423,11 @@ static int cnf_preparser(void* data, const char* section, const char* name, cons
} }
} }
} }
else if(strcmp(name, "libdir") == 0) else if (strcmp(name, "libdir") == 0)
{ {
if(strcmp(get_libdir(),default_libdir) == 0 ) if (strcmp(get_libdir(), default_libdir) == 0)
{ {
if(handle_path_arg(&tmp,(char*)value,NULL,true,false)) if (handle_path_arg(&tmp, (char*)value, NULL, true, false))
{ {
set_libdir(tmp); set_libdir(tmp);
} }
@ -2430,11 +2437,11 @@ static int cnf_preparser(void* data, const char* section, const char* name, cons
} }
} }
} }
else if(strcmp(name, "piddir") == 0) else if (strcmp(name, "piddir") == 0)
{ {
if(strcmp(get_piddir(),default_piddir) == 0) if (strcmp(get_piddir(), default_piddir) == 0)
{ {
if(handle_path_arg(&tmp,(char*)value,NULL,true,true)) if (handle_path_arg(&tmp, (char*)value, NULL, true, true))
{ {
set_piddir(tmp); set_piddir(tmp);
} }
@ -2444,13 +2451,13 @@ static int cnf_preparser(void* data, const char* section, const char* name, cons
} }
} }
} }
else if(strcmp(name, "datadir") == 0) else if (strcmp(name, "datadir") == 0)
{ {
if(!datadir_defined) if (!datadir_defined)
{ {
if(handle_path_arg(&tmp,(char*)value,NULL,true,false)) if (handle_path_arg(&tmp, (char*)value, NULL, true, false))
{ {
snprintf(datadir,PATH_MAX,"%s",tmp); snprintf(datadir, PATH_MAX, "%s", tmp);
datadir[PATH_MAX] = '\0'; datadir[PATH_MAX] = '\0';
set_datadir(tmp); set_datadir(tmp);
datadir_defined = true; datadir_defined = true;
@ -2461,11 +2468,11 @@ static int cnf_preparser(void* data, const char* section, const char* name, cons
} }
} }
} }
else if(strcmp(name, "cachedir") == 0) else if (strcmp(name, "cachedir") == 0)
{ {
if(strcmp(get_cachedir(),default_cachedir) == 0) if (strcmp(get_cachedir(), default_cachedir) == 0)
{ {
if(handle_path_arg((char**)&tmp,(char*)value,NULL,true,false)) if (handle_path_arg((char**)&tmp, (char*)value, NULL, true, false))
{ {
set_cachedir(tmp); set_cachedir(tmp);
} }
@ -2475,11 +2482,11 @@ static int cnf_preparser(void* data, const char* section, const char* name, cons
} }
} }
} }
else if(strcmp(name, "language") == 0) else if (strcmp(name, "language") == 0)
{ {
if(strcmp(get_langdir(),default_langdir) == 0) if (strcmp(get_langdir(), default_langdir) == 0)
{ {
if(handle_path_arg((char**)&tmp,(char*)value,NULL,true,false)) if (handle_path_arg((char**)&tmp, (char*)value, NULL, true, false))
{ {
set_langdir(tmp); set_langdir(tmp);
} }
@ -2489,15 +2496,15 @@ static int cnf_preparser(void* data, const char* section, const char* name, cons
} }
} }
} }
else if(strcmp(name, "syslog") == 0) else if (strcmp(name, "syslog") == 0)
{ {
cnf->syslog = config_truth_value((char*)value); cnf->syslog = config_truth_value((char*)value);
} }
else if(strcmp(name, "maxlog") == 0) else if (strcmp(name, "maxlog") == 0)
{ {
cnf->maxlog = config_truth_value((char*)value); cnf->maxlog = config_truth_value((char*)value);
} }
else if(strcmp(name, "log_augmentation") == 0) else if (strcmp(name, "log_augmentation") == 0)
{ {
set_log_augmentation(value); set_log_augmentation(value);
} }
@ -2513,16 +2520,16 @@ static int set_user(char* user)
int rval; int rval;
pwname = getpwnam(user); pwname = getpwnam(user);
if(pwname == NULL) if (pwname == NULL)
{ {
char errbuf[STRERROR_BUFLEN]; char errbuf[STRERROR_BUFLEN];
printf("Error: Failed to retrieve user information for '%s': %d %s\n", printf("Error: Failed to retrieve user information for '%s': %d %s\n",
user,errno,errno == 0 ? "User not found" : strerror_r(errno, errbuf, sizeof(errbuf))); user, errno, errno == 0 ? "User not found" : strerror_r(errno, errbuf, sizeof(errbuf)));
return -1; return -1;
} }
rval = setgid(pwname->pw_gid); rval = setgid(pwname->pw_gid);
if(rval != 0) if (rval != 0)
{ {
char errbuf[STRERROR_BUFLEN]; char errbuf[STRERROR_BUFLEN];
printf("Error: Failed to change group to '%d': %d %s\n", printf("Error: Failed to change group to '%d': %d %s\n",
@ -2531,16 +2538,16 @@ static int set_user(char* user)
} }
rval = setuid(pwname->pw_uid); rval = setuid(pwname->pw_uid);
if(rval != 0) if (rval != 0)
{ {
char errbuf[STRERROR_BUFLEN]; char errbuf[STRERROR_BUFLEN];
printf("Error: Failed to change user to '%s': %d %s\n", printf("Error: Failed to change user to '%s': %d %s\n",
pwname->pw_name, errno, strerror_r(errno, errbuf, sizeof(errbuf))); pwname->pw_name, errno, strerror_r(errno, errbuf, sizeof(errbuf)));
return rval; return rval;
} }
if(prctl(PR_GET_DUMPABLE) == 0) if (prctl(PR_GET_DUMPABLE) == 0)
{ {
if(prctl(PR_SET_DUMPABLE ,1) == -1) if (prctl(PR_SET_DUMPABLE , 1) == -1)
{ {
char errbuf[STRERROR_BUFLEN]; char errbuf[STRERROR_BUFLEN];
printf("Error: Failed to set dumpable flag on for the process '%s': %d %s\n", printf("Error: Failed to set dumpable flag on for the process '%s': %d %s\n",
@ -2551,7 +2558,7 @@ static int set_user(char* user)
#ifdef SS_DEBUG #ifdef SS_DEBUG
else else
{ {
printf("Running MaxScale as: %s %d:%d\n",pwname->pw_name,pwname->pw_uid,pwname->pw_gid); printf("Running MaxScale as: %s %d:%d\n", pwname->pw_name, pwname->pw_uid, pwname->pw_gid);
} }
#endif #endif