checkpatch fixes
This commit is contained in:
@@ -66,7 +66,7 @@ struct conf_table {
|
|||||||
};
|
};
|
||||||
|
|
||||||
extern struct conf_table conf;
|
extern struct conf_table conf;
|
||||||
extern int confparse(char *);
|
extern int confparse(char *config);
|
||||||
extern void confexport(void);
|
extern void confexport(void);
|
||||||
extern const char *conf_db_pass(void);
|
extern const char *conf_db_pass(void);
|
||||||
extern const char *conf_db_hostname(void);
|
extern const char *conf_db_hostname(void);
|
||||||
|
|||||||
@@ -34,11 +34,13 @@ static pthread_once_t init_once = PTHREAD_ONCE_INIT;
|
|||||||
|
|
||||||
static void open_logs(void)
|
static void open_logs(void)
|
||||||
{
|
{
|
||||||
if ((fderr = fopen(conf.rmps.errlog, "a")) == NULL)
|
fderr = fopen(conf.rmps.errlog, "a");
|
||||||
|
if (fderr == NULL)
|
||||||
fderr = stderr;
|
fderr = stderr;
|
||||||
else
|
else
|
||||||
setvbuf(fderr, NULL, _IOLBF, 0);
|
setvbuf(fderr, NULL, _IOLBF, 0);
|
||||||
if ((fdout = fopen(conf.rmps.logfile, "a")) == NULL)
|
fdout = fopen(conf.rmps.logfile, "a");
|
||||||
|
if (fdout == NULL)
|
||||||
fdout = stdout;
|
fdout = stdout;
|
||||||
else
|
else
|
||||||
setvbuf(fdout, NULL, _IOLBF, 0);
|
setvbuf(fdout, NULL, _IOLBF, 0);
|
||||||
|
|||||||
12
src/main.c
12
src/main.c
@@ -34,7 +34,7 @@ static void usage(char *argv)
|
|||||||
{
|
{
|
||||||
fprintf(stderr, "Usage:\n%s TASK [-c CONFIG] [-d]\n\n"
|
fprintf(stderr, "Usage:\n%s TASK [-c CONFIG] [-d]\n\n"
|
||||||
"Tasks:\n"
|
"Tasks:\n"
|
||||||
"\t--start\t\tStart the RMPS server. This is by default. \n"
|
"\t--start\t\tStart the RMPS server. This is by default.\n"
|
||||||
"\t--stop\t\tStop the RMPS server.\n"
|
"\t--stop\t\tStop the RMPS server.\n"
|
||||||
"\t--restart\tRestart the RMPS server.\n"
|
"\t--restart\tRestart the RMPS server.\n"
|
||||||
"\t-t, --test\tTest the configuration file and exit,\n"
|
"\t-t, --test\tTest the configuration file and exit,\n"
|
||||||
@@ -60,9 +60,8 @@ int main(int argc, char *argv[])
|
|||||||
TEST_AND_EXPORT
|
TEST_AND_EXPORT
|
||||||
};
|
};
|
||||||
static int task = START;
|
static int task = START;
|
||||||
const char opts_short[] = "dc:htT";
|
static const char opts_short[] = "dc:htT";
|
||||||
static struct option opts_long[] =
|
static struct option opts_long[] = {
|
||||||
{
|
|
||||||
{"start", no_argument, &task, START},
|
{"start", no_argument, &task, START},
|
||||||
{"stop", no_argument, &task, STOP},
|
{"stop", no_argument, &task, STOP},
|
||||||
{"restart", no_argument, &task, RESTART},
|
{"restart", no_argument, &task, RESTART},
|
||||||
@@ -74,13 +73,13 @@ int main(int argc, char *argv[])
|
|||||||
};
|
};
|
||||||
int opt = 0, opt_index = 0, fork_flag = 0;
|
int opt = 0, opt_index = 0, fork_flag = 0;
|
||||||
char *config = NULL;
|
char *config = NULL;
|
||||||
|
|
||||||
while ((opt = getopt_long(argc, argv, opts_short, opts_long,
|
while ((opt = getopt_long(argc, argv, opts_short, opts_long,
|
||||||
&opt_index)) != -1) {
|
&opt_index)) != -1) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 0:
|
case 0:
|
||||||
if (opts_long[opt_index].flag != 0) {
|
if (opts_long[opt_index].flag != 0)
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
log(INFO, "option %s", opts_long[opt_index].name);
|
log(INFO, "option %s", opts_long[opt_index].name);
|
||||||
if (optarg)
|
if (optarg)
|
||||||
log(INFO, "with arg %s\n", optarg);
|
log(INFO, "with arg %s\n", optarg);
|
||||||
@@ -109,6 +108,7 @@ int main(int argc, char *argv[])
|
|||||||
if (!config) {
|
if (!config) {
|
||||||
char path[] = "/etc/rmps/rmps.conf";
|
char path[] = "/etc/rmps/rmps.conf";
|
||||||
int path_size = strlen(path) + 1;
|
int path_size = strlen(path) + 1;
|
||||||
|
|
||||||
config = calloc(sizeof(char), path_size);
|
config = calloc(sizeof(char), path_size);
|
||||||
if (config == NULL) {
|
if (config == NULL) {
|
||||||
log(ERROR, "malloc() failed for config");
|
log(ERROR, "malloc() failed for config");
|
||||||
|
|||||||
Reference in New Issue
Block a user