diff options
Diffstat (limited to 'src/libs6/s6lock_acquire.c')
-rw-r--r-- | src/libs6/s6lock_acquire.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/libs6/s6lock_acquire.c b/src/libs6/s6lock_acquire.c index b0fef54..2bf6171 100644 --- a/src/libs6/s6lock_acquire.c +++ b/src/libs6/s6lock_acquire.c @@ -1,5 +1,7 @@ /* ISC license. */ +#include <sys/types.h> +#include <stdint.h> #include <errno.h> #include <skalibs/uint16.h> #include <skalibs/uint32.h> @@ -10,18 +12,19 @@ #include <skalibs/skaclient.h> #include <s6/s6lock.h> -int s6lock_acquire (s6lock_t *a, uint16 *u, char const *path, uint32 options, tain_t const *limit, tain_t const *deadline, tain_t *stamp) +int s6lock_acquire (s6lock_t *a, uint16_t *u, char const *path, uint32_t options, tain_t const *limit, tain_t const *deadline, tain_t *stamp) { - unsigned int pathlen = str_len(path) ; + size_t pathlen = str_len(path) ; char err ; char tmp[23] = "--<" ; siovec_t v[2] = { { .s = tmp, .len = 23 }, { .s = (char *)path, .len = pathlen + 1 } } ; unsigned int i ; + if (pathlen > UINT32_MAX) return (errno = ENAMETOOLONG, 0) ; if (!gensetdyn_new(&a->data, &i)) return 0 ; - uint16_pack_big(tmp, (uint16)i) ; + uint16_pack_big(tmp, (uint16_t)i) ; uint32_pack_big(tmp+3, options) ; tain_pack(tmp+7, limit) ; - uint32_pack_big(tmp+19, (uint32)pathlen) ; + uint32_pack_big(tmp+19, (uint32_t)pathlen) ; if (!skaclient_sendv(&a->connection, v, 2, &skaclient_default_cb, &err, deadline, stamp)) { gensetdyn_delete(&a->data, i) ; |