diff options
| author | Garrett D'Amore <garrett@damore.org> | 2018-03-20 18:38:54 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2018-03-20 18:42:23 -0700 |
| commit | 6df40cb6eea9a4220d61c4c927ce5a857a12a338 (patch) | |
| tree | ac4b7ecbcb41a456eb4d0429fc180047656371ba /src/core/endpt.c | |
| parent | 9ca901c1b70b17d851426483d9f54611cfa8e395 (diff) | |
| download | nng-6df40cb6eea9a4220d61c4c927ce5a857a12a338.tar.gz nng-6df40cb6eea9a4220d61c4c927ce5a857a12a338.tar.bz2 nng-6df40cb6eea9a4220d61c4c927ce5a857a12a338.zip | |
fixes #301 String option handling for getopt
Diffstat (limited to 'src/core/endpt.c')
| -rw-r--r-- | src/core/endpt.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/core/endpt.c b/src/core/endpt.c index 131ee1db..d4bc9b01 100644 --- a/src/core/endpt.c +++ b/src/core/endpt.c @@ -649,12 +649,8 @@ nni_ep_getopt(nni_ep *ep, const char *name, void *valp, size_t *szp, int t) if (eo->eo_getopt == NULL) { return (NNG_EWRITEONLY); } - if ((t != NNI_TYPE_OPAQUE) && - (eo->eo_type != NNI_TYPE_OPAQUE) && (t != eo->eo_type)) { - return (NNG_EBADTYPE); - } nni_mtx_lock(&ep->ep_mtx); - rv = eo->eo_getopt(ep->ep_data, valp, szp); + rv = eo->eo_getopt(ep->ep_data, valp, szp, t); nni_mtx_unlock(&ep->ep_mtx); return (rv); } @@ -663,11 +659,7 @@ nni_ep_getopt(nni_ep *ep, const char *name, void *valp, size_t *szp, int t) // override. This allows the URL to be created with wildcards, // that are resolved later. if (strcmp(name, NNG_OPT_URL) == 0) { - if (t != NNI_TYPE_OPAQUE) { - // XXX: Add NNI_TYPE_STRING. - return (NNG_EBADTYPE); - } - return (nni_getopt_str(ep->ep_url->u_rawurl, valp, szp)); + return (nni_copyout_str(ep->ep_url->u_rawurl, valp, szp, t)); } return (nni_sock_getopt(ep->ep_sock, name, valp, szp, t)); |
