diff --git a/io/ipc.c b/io/ipc.c index 4dc1c37..d2cd639 100644 --- a/io/ipc.c +++ b/io/ipc.c @@ -1,12 +1,9 @@ #include "ipc.h" -#include #include #include -#include #include #include -#include #include static int make_server_socket(const char *path) diff --git a/io/ipc.h b/io/ipc.h index 15ecdfd..95b049d 100644 --- a/io/ipc.h +++ b/io/ipc.h @@ -2,6 +2,9 @@ #include #include +#include +#include +#include #define IPC_SOCKET_PATH "/tmp/ipc_demo.sock" #define IPC_BACKLOG 1 @@ -13,7 +16,7 @@ typedef struct { volatile int running; ipc_client_fn handler; pthread_t _tid; /* internal — do not touch */ - const char* socket_path; + char* socket_path; } ipc_ctx_t; int create_ipc(ipc_ctx_t *ctx, ipc_client_fn handler, const char* socket_path); void destroy_ipc(ipc_ctx_t *ctx); \ No newline at end of file diff --git a/src/fm95.c b/src/fm95.c index a463762..fe3383a 100644 --- a/src/fm95.c +++ b/src/fm95.c @@ -482,10 +482,11 @@ static void *handle_client(void *arg) { int main(int argc, char **argv) { printf("fm95 (an FM Processor by radio95) version 2.5\n"); - ipc_ctx_t ctx = NULL; - if(create_ipc(&ctx, handle_client, "/etc/fm95/ctl.socket") < 0) { + ipc_ctx_t ctx; + ipc_ctx_t *pctx = &ctx; + if(create_ipc(pctx, handle_client, "/etc/fm95/ctl.socket") < 0) { printf("Could not create IPC.\n"); - ctx = NULL; + pctx = NULL; } @@ -603,6 +604,6 @@ int main(int argc, char **argv) { cleanup_audio_runtime(&runtime, config.options); break; } - if(ctx != NULL) destroy_ipc(&ctx); + if(pctx != NULL) destroy_ipc(pctx); return ret; }