From 5c8752dfc69485e2a1cd175adb42c8baf50b45fc Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Sun, 16 May 2021 16:57:01 +0200 Subject: [PATCH] Get rid of various warnings/errors due to recent work. --- src/conf.c | 1 + src/modules/history_backend_mem.c | 20 +++++++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/conf.c b/src/conf.c index b28ff4282..e0703646b 100644 --- a/src/conf.c +++ b/src/conf.c @@ -10332,6 +10332,7 @@ int _test_secret(ConfigFile *conf, ConfigEntry *ce) config_error("%s:%i: secret block needs a name, eg: secret xyz {", ce->ce_fileptr->cf_filename, ce->ce_varlinenum); errors++; + return errors; /* need to return here since we dereference ce->ce_vardata later.. */ } else { if (!security_group_valid_name(ce->ce_vardata)) { diff --git a/src/modules/history_backend_mem.c b/src/modules/history_backend_mem.c index 48e611e39..28dd81a88 100644 --- a/src/modules/history_backend_mem.c +++ b/src/modules/history_backend_mem.c @@ -286,9 +286,9 @@ int hbm_config_posttest(int *errs) /* Ensure directory exists and is writable */ #ifdef _WIN32 - mkdir(test.directory); /* (errors ignored) */ + (void)mkdir(test.directory); /* (errors ignored) */ #else - mkdir(test.directory, S_IRUSR|S_IWUSR|S_IXUSR); /* (errors ignored) */ + (void)mkdir(test.directory, S_IRUSR|S_IWUSR|S_IXUSR); /* (errors ignored) */ #endif if (!file_exists(test.directory)) { @@ -700,6 +700,9 @@ static int hbm_write_masterdb(void) uint32_t mdb_version; char buf[512]; + if (!test.db_secret) + abort(); + db = unrealdb_open(test.masterdb, UNREALDB_MODE_WRITE, test.db_secret); if (!db) { @@ -776,13 +779,13 @@ static void hbm_read_dbs(void) char buf2[512]; snprintf(buf2, sizeof(buf2), "%s/bad", cfg.directory); #ifdef _WIN32 - mkdir(buf2); /* (errors ignored) */ + (void)mkdir(buf2); /* (errors ignored) */ #else - mkdir(buf2, S_IRUSR|S_IWUSR|S_IXUSR); /* (errors ignored) */ + (void)mkdir(buf2, S_IRUSR|S_IWUSR|S_IXUSR); /* (errors ignored) */ #endif snprintf(buf2, sizeof(buf2), "%s/bad/%s", cfg.directory, fname); unlink(buf2); - rename(buf, buf2); + (void)rename(buf, buf2); } } @@ -1012,6 +1015,9 @@ static int hbm_write_db(HistoryLogObject *h) MessageTag *m; Channel *channel; + if (!cfg.db_secret) + abort(); + channel = find_channel(h->name, NULL); if (!channel || !has_channel_mode(channel, 'P')) return 1; /* Don't save this channel, pretend success */ @@ -1019,10 +1025,6 @@ static int hbm_write_db(HistoryLogObject *h) realfname = hbm_history_filename(h); snprintf(tmpfname, sizeof(tmpfname), "%s.tmp", realfname); -#ifdef DEBUGMODE - ircd_log(LOG_ERROR, "Writing to: %s...", tmpfname); -#endif - db = unrealdb_open(tmpfname, UNREALDB_MODE_WRITE, cfg.db_secret); if (!db) {