diff options
| author | Laurent Bercot <ska-skaware@skarnet.org> | 2026-03-16 23:33:42 +0000 |
|---|---|---|
| committer | Laurent Bercot <ska-skaware@skarnet.org> | 2026-03-16 23:33:42 +0000 |
| commit | cd456a4cafa392edcf96796fee73a0095b19b825 (patch) | |
| tree | 97d95159d5bcbc822cc266bd238b3a34fdc57054 /src/libunixonacid | |
| parent | 48722f9f3c7575225fe73dd96fc2a4fbc710d738 (diff) | |
| download | skalibs-cd456a4cafa392edcf96796fee73a0095b19b825.tar.gz | |
And another one
Diffstat (limited to 'src/libunixonacid')
| -rw-r--r-- | src/libunixonacid/sassclient_cancel_internal.c | 6 | ||||
| -rw-r--r-- | src/libunixonacid/sassclient_sendv.c | 9 |
2 files changed, 9 insertions, 6 deletions
diff --git a/src/libunixonacid/sassclient_cancel_internal.c b/src/libunixonacid/sassclient_cancel_internal.c index 03eeea4..a18a5c2 100644 --- a/src/libunixonacid/sassclient_cancel_internal.c +++ b/src/libunixonacid/sassclient_cancel_internal.c @@ -12,10 +12,12 @@ int sassclient_cancel_internal (sassclient *a, uint32_t id, tain const *deadline, tain *stamp) { struct iovec answer ; + uint32_t ans ; char pack[5] = "-" ; uint32_pack_big(pack + 1, id) ; if (!textclient_exchange(&a->connection, pack, 5, &answer, deadline, stamp)) return errno ; - if (answer.iov_len != 1) return EPROTO ; - return *(uint8_t *)answer.iov_base ; + if (answer.iov_len != 4) return EPROTO ; + uint32_unpack_big((char *)answer.iov_base, &ans) ; + return ans ; } diff --git a/src/libunixonacid/sassclient_sendv.c b/src/libunixonacid/sassclient_sendv.c index 7cead5f..e31de07 100644 --- a/src/libunixonacid/sassclient_sendv.c +++ b/src/libunixonacid/sassclient_sendv.c @@ -19,13 +19,13 @@ int sassclient_sendv (sassclient *a, uint32_t *cid, uint32_t flags, uint32_t timeout, uint32_t opcode, struct iovec const *vv, unsigned int n, sassclient_cb_func_ref cb, void *data, tain const *deadline, tain *stamp) { size_t len = siovec_len(vv, n) ; - uint32_t id ; + uint32_t id, ans ; int e ; struct iovec answer ; sassclient_data *p ; char pack[21] = "+" ; struct iovec v[1 + n] ; - if (len + 11 > UINT32_MAX) return (errno = ENAMETOOLONG, 0) ; + if (len + 17 > UINT32_MAX) return (errno = ENAMETOOLONG, 0) ; e = pthread_mutex_tailock(&a->connection_mutex, deadline, stamp) ; if (e) return (errno = e, 0) ; @@ -39,8 +39,9 @@ int sassclient_sendv (sassclient *a, uint32_t *cid, uint32_t flags, uint32_t tim uint32_pack_big(pack + 13, opcode) ; uint32_pack_big(pack + 17, len) ; if (!textclient_exchangev(&a->connection, v, 1 + n, &answer, deadline, stamp)) { e = errno ; goto err0 ; } - if (answer.iov_len == 1) { e = *(unsigned char *)answer.iov_base ; goto err0 ; } - if (answer.iov_len != 5 || *(unsigned char *)answer.iov_base) { e = EPROTO ; goto err0 ; } + if (answer.iov_len != 4) { e = EPROTO ; goto err0 ; } + uint32_unpack_big((char *)answer.iov_base, &ans) ; + if (ans) { e = ans ; goto err0 ; } p = GENSETDYN_P(sassclient_data, &a->store, id) ; p->cb = cb ; p->data = data ; |
