Skip to content

Commit

Permalink
libnetconf2 BUGFIX proper uint32_t print macros
Browse files Browse the repository at this point in the history
  • Loading branch information
michalvasko committed Apr 26, 2024
1 parent b7bc8c3 commit 1637471
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,7 @@ nc_write_msg_io(struct nc_session *session, int io_timeout, int type, ...)
nc_write_clb((void *)&arg, "</capability>", 13, 0);
}
if (sid) {
count = asprintf(&buf, "</capabilities><session-id>%u</session-id></hello>", *sid);
count = asprintf(&buf, "</capabilities><session-id>%" PRIu32 "</session-id></hello>", *sid);
NC_CHECK_ERRMEM_GOTO(count == -1, ret = NC_MSG_ERROR, cleanup);
nc_write_clb((void *)&arg, buf, count, 0);
free(buf);
Expand Down
2 changes: 1 addition & 1 deletion src/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ prv_vprintf(const struct nc_session *session, NC_VERB_LEVEL level, const char *f
if (print_clb) {
print_clb(session, level, prv_msg);
} else if (session && session->id) {
fprintf(stderr, "Session %u %s: %s\n", session->id, verb[level].label, prv_msg);
fprintf(stderr, "Session %" PRIu32 " %s: %s\n", session->id, verb[level].label, prv_msg);
} else {
fprintf(stderr, "%s: %s\n", verb[level].label, prv_msg);
}
Expand Down
6 changes: 3 additions & 3 deletions src/server_config_util_tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ nc_server_config_add_tls_ctn(const struct ly_ctx *ctx, const char *endpt_name, u
NC_CHECK_ARG_RET(NULL, ctx, endpt_name, id, name, config, 1);

ret = asprintf(&path, "/ietf-netconf-server:netconf-server/listen/endpoints/endpoint[name='%s']/tls/netconf-server-parameters/"
"client-identity-mappings/cert-to-name[id='%u']", endpt_name, id);
"client-identity-mappings/cert-to-name[id='%" PRIu32 "']", endpt_name, id);
NC_CHECK_ERRMEM_GOTO(ret == -1, path = NULL; ret = 1, cleanup);

ret = _nc_server_config_add_tls_ctn(ctx, path, fingerprint, map_type, name, config);
Expand All @@ -722,7 +722,7 @@ nc_server_config_del_tls_ctn(const char *endpt_name, uint32_t id, struct lyd_nod

if (id) {
return nc_server_config_delete(config, "/ietf-netconf-server:netconf-server/listen/endpoints/endpoint[name='%s']/tls/"
"netconf-server-parameters/client-identity-mappings/cert-to-name[id='%u']", endpt_name, id);
"netconf-server-parameters/client-identity-mappings/cert-to-name[id='%" PRIu32 "']", endpt_name, id);
} else {
return nc_server_config_delete(config, "/ietf-netconf-server:netconf-server/listen/endpoints/endpoint[name='%s']/tls/"
"netconf-server-parameters/client-identity-mappings/cert-to-name", endpt_name);
Expand All @@ -740,7 +740,7 @@ nc_server_config_add_ch_tls_ctn(const struct ly_ctx *ctx, const char *client_nam

ret = asprintf(&path, "/ietf-netconf-server:netconf-server/call-home/netconf-client[name='%s']/"
"endpoints/endpoint[name='%s']/tls/netconf-server-parameters/client-identity-mappings/"
"cert-to-name[id='%u']", client_name, endpt_name, id);
"cert-to-name[id='%" PRIu32 "']", client_name, endpt_name, id);
NC_CHECK_ERRMEM_GOTO(ret == -1, path = NULL; ret = 1, cleanup);

ret = _nc_server_config_add_tls_ctn(ctx, path, fingerprint, map_type, name, config);
Expand Down
14 changes: 7 additions & 7 deletions src/session_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -2800,7 +2800,7 @@ nc_send_rpc(struct nc_session *session, struct nc_rpc *rpc, int timeout, uint64_
rpc_k = (struct nc_rpc_kill *)rpc;

CHECK_LYRC_BREAK(lyd_new_inner(NULL, mod, "kill-session", 0, &data));
sprintf(str, "%u", rpc_k->sid);
sprintf(str, "%" PRIu32, rpc_k->sid);
CHECK_LYRC_BREAK(lyd_new_term(data, mod, "session-id", str, 0, NULL));
break;

Expand All @@ -2813,7 +2813,7 @@ nc_send_rpc(struct nc_session *session, struct nc_rpc *rpc, int timeout, uint64_
}

if (rpc_com->confirm_timeout) {
sprintf(str, "%u", rpc_com->confirm_timeout);
sprintf(str, "%" PRIu32, rpc_com->confirm_timeout);
CHECK_LYRC_BREAK(lyd_new_term(data, mod, "confirm-timeout", str, 0, NULL));
}
if (rpc_com->persist) {
Expand Down Expand Up @@ -2976,7 +2976,7 @@ nc_send_rpc(struct nc_session *session, struct nc_rpc *rpc, int timeout, uint64_

CHECK_LYRC_BREAK(lyd_new_inner(NULL, mod, "modify-subscription", 0, &data));

sprintf(str, "%u", rpc_modsub->id);
sprintf(str, "%" PRIu32, rpc_modsub->id);
CHECK_LYRC_BREAK(lyd_new_term(data, mod, "id", str, 0, NULL));

if (rpc_modsub->filter) {
Expand All @@ -2999,7 +2999,7 @@ nc_send_rpc(struct nc_session *session, struct nc_rpc *rpc, int timeout, uint64_

CHECK_LYRC_BREAK(lyd_new_inner(NULL, mod, "delete-subscription", 0, &data));

sprintf(str, "%u", rpc_delsub->id);
sprintf(str, "%" PRIu32, rpc_delsub->id);
CHECK_LYRC_BREAK(lyd_new_term(data, mod, "id", str, 0, NULL));
break;

Expand All @@ -3008,7 +3008,7 @@ nc_send_rpc(struct nc_session *session, struct nc_rpc *rpc, int timeout, uint64_

CHECK_LYRC_BREAK(lyd_new_inner(NULL, mod, "kill-subscription", 0, &data));

sprintf(str, "%u", rpc_killsub->id);
sprintf(str, "%" PRIu32, rpc_killsub->id);
CHECK_LYRC_BREAK(lyd_new_term(data, mod, "id", str, 0, NULL));
break;

Expand Down Expand Up @@ -3065,7 +3065,7 @@ nc_send_rpc(struct nc_session *session, struct nc_rpc *rpc, int timeout, uint64_

CHECK_LYRC_BREAK(lyd_new_inner(NULL, mod, "modify-subscription", 0, &data));

sprintf(str, "%u", rpc_modpush->id);
sprintf(str, "%" PRIu32, rpc_modpush->id);
CHECK_LYRC_BREAK(lyd_new_term(data, mod, "id", str, 0, NULL));
CHECK_LYRC_BREAK(lyd_new_term(data, mod2, "datastore", rpc_modpush->datastore, 0, NULL));

Expand Down Expand Up @@ -3103,7 +3103,7 @@ nc_send_rpc(struct nc_session *session, struct nc_rpc *rpc, int timeout, uint64_
rpc_resyncsub = (struct nc_rpc_resyncsub *)rpc;

CHECK_LYRC_BREAK(lyd_new_inner(NULL, mod, "resync-subscription", 0, &data));
sprintf(str, "%u", rpc_resyncsub->id);
sprintf(str, "%" PRIu32, rpc_resyncsub->id);
CHECK_LYRC_BREAK(lyd_new_term(data, mod, "id", str, 0, NULL));
break;

Expand Down

0 comments on commit 1637471

Please sign in to comment.