summaryrefslogtreecommitdiff
path: root/src/libs6/s6lock_acquire.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2017-03-12 11:59:43 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2017-03-12 11:59:43 +0000
commitc60ebd422171808ad58b936914055397bb205bef (patch)
tree7db3e5728d72ad209f8e22b9eb9f337e0b0c3e58 /src/libs6/s6lock_acquire.c
parente28fe5908a91d8795ca9923d64eeed7d3e898434 (diff)
downloads6-c60ebd422171808ad58b936914055397bb205bef.tar.xz
Adapt to skalibs-2.5.0.0
Diffstat (limited to 'src/libs6/s6lock_acquire.c')
-rw-r--r--src/libs6/s6lock_acquire.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/libs6/s6lock_acquire.c b/src/libs6/s6lock_acquire.c
index 2bf6171..d9b4170 100644
--- a/src/libs6/s6lock_acquire.c
+++ b/src/libs6/s6lock_acquire.c
@@ -1,12 +1,10 @@
/* ISC license. */
-#include <sys/types.h>
+#include <sys/uio.h>
+#include <string.h>
#include <stdint.h>
#include <errno.h>
-#include <skalibs/uint16.h>
-#include <skalibs/uint32.h>
-#include <skalibs/bytestr.h>
-#include <skalibs/siovec.h>
+#include <skalibs/types.h>
#include <skalibs/tai.h>
#include <skalibs/gensetdyn.h>
#include <skalibs/skaclient.h>
@@ -14,13 +12,18 @@
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)
{
- size_t pathlen = str_len(path) ;
+ size_t pathlen = strlen(path) ;
char err ;
char tmp[23] = "--<" ;
- siovec_t v[2] = { { .s = tmp, .len = 23 }, { .s = (char *)path, .len = pathlen + 1 } } ;
+ struct iovec v[2] = { { .iov_base = tmp, .iov_len = 23 }, { .iov_base = (char *)path, .iov_len = pathlen + 1 } } ;
unsigned int i ;
if (pathlen > UINT32_MAX) return (errno = ENAMETOOLONG, 0) ;
if (!gensetdyn_new(&a->data, &i)) return 0 ;
+ if (i > UINT16_MAX)
+ {
+ gensetdyn_delete(&a->data, i) ;
+ return (errno = EMFILE, 0) ;
+ }
uint16_pack_big(tmp, (uint16_t)i) ;
uint32_pack_big(tmp+3, options) ;
tain_pack(tmp+7, limit) ;