diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..1d953f4 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use nix diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..dac87db --- /dev/null +++ b/shell.nix @@ -0,0 +1,8 @@ +with import {}; +mkShell { + nativeBuildInputs = [ + cmake + sqlite + util-linux + ]; +} diff --git a/sql/migration_0.sql b/sql/migration_0.sql index 939b907..ec39fba 100644 --- a/sql/migration_0.sql +++ b/sql/migration_0.sql @@ -80,4 +80,4 @@ CREATE TABLE junction_relay_schedule ); INSERT INTO schedules (uid, name, periods) VALUES (x'6f666600000000000000000000000000', 'off', x'00'); -INSERT INTO schedules (uid, name, periods) VALUES (x'6f6e0000000000000000000000000000', 'on', x'010000009F05'); +INSERT INTO schedules (uid, name, periods) VALUES (x'6f6e0000000000000000000000000000', 'on', x'010000000000'); diff --git a/src/main.c b/src/main.c index 026522d..fdfe01a 100644 --- a/src/main.c +++ b/src/main.c @@ -22,7 +22,7 @@ static struct mg_mgr mgr; static void terminate(int signum) { - LOGGER_INFO("terminating controller (%d)\n", signum); + LOGGER_INFO("terminating core (%d)\n", signum); mg_mgr_free(&mgr); diff --git a/src/router.c b/src/router.c index e683891..dfc68db 100644 --- a/src/router.c +++ b/src/router.c @@ -154,7 +154,7 @@ router_register_endpoint(const char *route, int method, endpoint_func_f func) // +1 for NULL terminator endpoint->route = malloc(sizeof(char*) * (route_parts_count + 1)); endpoint->route_keeper = malloc(sizeof(char) * (route_len + 1)); - strncpy(endpoint->route_keeper, route, route_len); + strncpy(endpoint->route_keeper, route, route_len + 1); endpoint->route_keeper[route_len] = '\0'; int route_part = 0; diff --git a/vendor/mongoose.h b/vendor/mongoose.h index 7808e91..aac725e 100644 --- a/vendor/mongoose.h +++ b/vendor/mongoose.h @@ -1867,7 +1867,7 @@ typedef struct { void cs_md5_init(cs_md5_ctx *c); void cs_md5_update(cs_md5_ctx *c, const unsigned char *data, size_t len); -void cs_md5_final(unsigned char *md, cs_md5_ctx *c); +void cs_md5_final(unsigned char digest[16], cs_md5_ctx *c); #ifdef __cplusplus }