checkpatch fixes

This commit is contained in:
2019-01-09 23:58:59 +02:00
parent fcdb9a6980
commit c0086a8509
3 changed files with 11 additions and 9 deletions

View File

@@ -66,7 +66,7 @@ struct conf_table {
};
extern struct conf_table conf;
extern int confparse(char *);
extern int confparse(char *config);
extern void confexport(void);
extern const char *conf_db_pass(void);
extern const char *conf_db_hostname(void);

View File

@@ -34,11 +34,13 @@ static pthread_once_t init_once = PTHREAD_ONCE_INIT;
static void open_logs(void)
{
if ((fderr = fopen(conf.rmps.errlog, "a")) == NULL)
fderr = fopen(conf.rmps.errlog, "a");
if (fderr == NULL)
fderr = stderr;
else
setvbuf(fderr, NULL, _IOLBF, 0);
if ((fdout = fopen(conf.rmps.logfile, "a")) == NULL)
fdout = fopen(conf.rmps.logfile, "a");
if (fdout == NULL)
fdout = stdout;
else
setvbuf(fdout, NULL, _IOLBF, 0);

View File

@@ -60,9 +60,8 @@ int main(int argc, char *argv[])
TEST_AND_EXPORT
};
static int task = START;
const char opts_short[] = "dc:htT";
static struct option opts_long[] =
{
static const char opts_short[] = "dc:htT";
static struct option opts_long[] = {
{"start", no_argument, &task, START},
{"stop", no_argument, &task, STOP},
{"restart", no_argument, &task, RESTART},
@@ -74,13 +73,13 @@ int main(int argc, char *argv[])
};
int opt = 0, opt_index = 0, fork_flag = 0;
char *config = NULL;
while ((opt = getopt_long(argc, argv, opts_short, opts_long,
&opt_index)) != -1) {
switch (opt) {
case 0:
if (opts_long[opt_index].flag != 0) {
if (opts_long[opt_index].flag != 0)
break;
}
log(INFO, "option %s", opts_long[opt_index].name);
if (optarg)
log(INFO, "with arg %s\n", optarg);
@@ -109,6 +108,7 @@ int main(int argc, char *argv[])
if (!config) {
char path[] = "/etc/rmps/rmps.conf";
int path_size = strlen(path) + 1;
config = calloc(sizeof(char), path_size);
if (config == NULL) {
log(ERROR, "malloc() failed for config");