jcs
/subtext
/amendments
/201
sysop: Write new config but don't apply it on the fly
There are things in the idle loop that check for config settings and
we can't assume they were there at startup
jcs made amendment 201 over 2 years ago
--- sysop.c Tue Jul 12 09:46:55 2022
+++ sysop.c Wed Jul 13 09:53:41 2022
@@ -83,7 +83,7 @@ sysop_menu(struct session *s)
void
sysop_edit_settings(struct session *s)
{
- struct config *new_config;
+ struct config *new_config, old_config;
short ret;
if (!s->user || !s->user->is_sysop)
@@ -97,11 +97,14 @@ sysop_edit_settings(struct session *s)
return;
}
+ memcpy(&old_config, &db->config, sizeof(db->config));
memcpy(&db->config, new_config, sizeof(db->config));
db_config_save(db);
+ memcpy(&db->config, &old_config, sizeof(db->config));
session_log(s, "Changed BBS settings");
- session_printf(s, "Successfully saved changes to BBS Settings\r\n");
+ session_printf(s, "Successfully saved changes to BBS Settings, "
+ "restart to take effect\r\n");
free(new_config);
}