--- embedaddon/mpd/src/ccp_mppc.c 2013/07/22 08:44:29 1.1.1.1 +++ embedaddon/mpd/src/ccp_mppc.c 2021/03/17 00:39:23 1.1.1.2 @@ -66,7 +66,7 @@ static Mbuf MppcRecvResetReq(Bund b, int id, Mbuf bp, int *noAck); static char *MppcDescribeBits(u_int32_t bits, char *buf, size_t len); static int MppcNegotiated(Bund b, int xmit); - static int MppcSetCommand(Context ctx, int ac, char *av[], void *arg); + static int MppcSetCommand(Context ctx, int ac, const char *const av[], const void *arg); /* Encryption stuff */ static void MppeInitKey(Bund b, MppcInfo mppc, int dir); @@ -130,7 +130,7 @@ MppcSetCommand, NULL, 2, (void *) SET_YES }, { "no [opt ...]", "Disable and deny option", MppcSetCommand, NULL, 2, (void *) SET_NO }, - { NULL }, + { NULL, NULL, NULL, NULL, 0, NULL }, }; int MPPCPresent = 0; @@ -197,7 +197,11 @@ MppcInit(Bund b, int dir) strlcat(path, ppphook, sizeof(path)); - id = NgGetNodeID(-1, path); + if ((id = NgGetNodeID(-1, path)) == 0) { + Perror("[%s] Cannot get %s node id", b->name, NG_MPPC_NODE_TYPE); + goto fail; + } + if (dir == COMP_DIR_XMIT) { b->ccp.comp_node_id = id; } else { @@ -210,12 +214,15 @@ MppcInit(Bund b, int dir) NGM_MPPC_COOKIE, cmd, &conf, sizeof(conf)) < 0) { Perror("[%s] can't config %s node at %s", b->name, NG_MPPC_NODE_TYPE, path); - NgFuncShutdownNode(gCcpCsock, b->name, path); - return(-1); + goto fail; } /* Done */ return(0); + +fail: + NgFuncShutdownNode(gCcpCsock, b->name, path); + return(-1); } static int @@ -489,6 +496,10 @@ static Mbuf MppcRecvResetReq(Bund b, int id, Mbuf bp, int *noAck) { char path[NG_PATHSIZ]; + + (void)id; + (void)bp; + /* Forward ResetReq to the MPPC compression node */ snprintf(path, sizeof(path), "[%x]:", b->ccp.comp_node_id); if (NgSendMsg(gCcpCsock, path, @@ -803,10 +814,14 @@ done: */ int -MppcStat(Context ctx, int ac, char *av[], void *arg) +MppcStat(Context ctx, int ac, const char *const av[], const void *arg) { MppcInfo const mppc = &ctx->bund->ccp.mppc; + (void)ac; + (void)av; + (void)arg; + Printf("MPPC options:\r\n"); OptStat(ctx, &mppc->options, gConfList); @@ -818,7 +833,7 @@ MppcStat(Context ctx, int ac, char *av[], void *arg) */ static int -MppcSetCommand(Context ctx, int ac, char *av[], void *arg) +MppcSetCommand(Context ctx, int ac, const char *const av[], const void *arg) { MppcInfo const mppc = &ctx->bund->ccp.mppc;