summaryrefslogtreecommitdiff
path: root/src/libs6/s6lock_acquire.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2017-01-12 23:16:36 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2017-01-12 23:16:36 +0000
commitbf6d072124a960d3b84ae39cd15c5aeca2e41c88 (patch)
treec082150f61e67d929b1baca2f5c6104fe959ccac /src/libs6/s6lock_acquire.c
parent81c7a02ec870ef3dba9f8b8f8dbecbd119e5ea47 (diff)
downloads6-bf6d072124a960d3b84ae39cd15c5aeca2e41c88.tar.xz
Types fix, first pass
Diffstat (limited to 'src/libs6/s6lock_acquire.c')
-rw-r--r--src/libs6/s6lock_acquire.c11
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) ;