Skip to content

Commit 6a2e489

Browse files
authored
Merge pull request #178 from 6WIND/searchpath-unix-fd
session_client: fix user searchpath for unix/fd transports
2 parents b467d4d + 484c112 commit 6a2e489

1 file changed

Lines changed: 6 additions & 22 deletions

File tree

src/session_client.c

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,18 +1098,10 @@ nc_connect_inout(int fdin, int fdout, struct ly_ctx *ctx)
10981098
session->ti.fd.in = fdin;
10991099
session->ti.fd.out = fdout;
11001100

1101-
/* assign context (dicionary needed for handshake) */
1102-
if (!ctx) {
1103-
ctx = ly_ctx_new(NC_SCHEMAS_DIR, LY_CTX_NOYANGLIBRARY);
1104-
/* definitely should not happen, but be ready */
1105-
if (!ctx && !(ctx = ly_ctx_new(NULL, 0))) {
1106-
/* that's just it */
1107-
goto fail;
1108-
}
1109-
} else {
1110-
session->flags |= NC_SESSION_SHAREDCTX;
1101+
if (nc_session_new_ctx(session, ctx) != EXIT_SUCCESS) {
1102+
goto fail;
11111103
}
1112-
session->ctx = ctx;
1104+
ctx = session->ctx;
11131105

11141106
/* NETCONF handshake */
11151107
if (nc_handshake_io(session) != NC_MSG_HELLO) {
@@ -1182,18 +1174,10 @@ nc_connect_unix(const char *address, struct ly_ctx *ctx)
11821174
session->ti.unixsock.sock = sock;
11831175
sock = -1; /* do not close sock in fail label anymore */
11841176

1185-
/* assign context (dictionary needed for handshake) */
1186-
if (!ctx) {
1187-
ctx = ly_ctx_new(NC_SCHEMAS_DIR, LY_CTX_NOYANGLIBRARY);
1188-
/* definitely should not happen, but be ready */
1189-
if (!ctx && !(ctx = ly_ctx_new(NULL, 0))) {
1190-
/* that's just it */
1191-
goto fail;
1192-
}
1193-
} else {
1194-
session->flags |= NC_SESSION_SHAREDCTX;
1177+
if (nc_session_new_ctx(session, ctx) != EXIT_SUCCESS) {
1178+
goto fail;
11951179
}
1196-
session->ctx = ctx;
1180+
ctx = session->ctx;
11971181

11981182
session->path = lydict_insert(ctx, address, 0);
11991183

0 commit comments

Comments
 (0)