Skip to content

Commit c90b82d

Browse files
committed
examples UPDATE use hidden unix sock path
1 parent ea053b0 commit c90b82d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

examples/server.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,13 +235,19 @@ init(const char *unix_socket_path, struct ly_ctx **context, struct nc_pollsessio
235235
ERR_MSG_CLEANUP("Error while parsing the example configuration data.\n");
236236
}
237237

238-
/* add UNIX socket to the configuration tree if the path was specified */
239238
if (unix_socket_path) {
239+
/* add UNIX socket endpoint to the configuration tree if the path was specified */
240240
rc = nc_server_config_add_unix_socket(*context, "unix-socket-endpt",
241-
unix_socket_path, NULL, NULL, NULL, &config);
241+
NULL, NULL, NULL, NULL, &config);
242242
if (rc) {
243243
ERR_MSG_CLEANUP("Creating UNIX socket endpoint configuration failed.\n");
244244
}
245+
246+
/* use the specified path for the UNIX socket endpoint */
247+
rc = nc_server_set_unix_socket_path("unix-socket-endpt", unix_socket_path);
248+
if (rc) {
249+
ERR_MSG_CLEANUP("Setting UNIX socket path failed.\n");
250+
}
245251
}
246252

247253
/* since nc_server_config_setup_data() requires all implicit nodes to be present and the example

0 commit comments

Comments
 (0)