summaryrefslogtreecommitdiff
path: root/src/libs6/s6lock_acquire.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2017-12-22 17:37:09 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2017-12-22 17:37:09 +0000
commitd7242bda59ec2ec056508b39cb532b5e7318dd13 (patch)
treeffb04351e694d0f7935062127daf0d1b47ebf3d2 /src/libs6/s6lock_acquire.c
parentda7304bbbfb90ced7a00acf5dbca0319d89fcc3a (diff)
downloads6-d7242bda59ec2ec056508b39cb532b5e7318dd13.tar.xz
Port ftrigr and s6lock to textclient
Diffstat (limited to 'src/libs6/s6lock_acquire.c')
-rw-r--r--src/libs6/s6lock_acquire.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/libs6/s6lock_acquire.c b/src/libs6/s6lock_acquire.c
index b9791bf..3ce6c77 100644
--- a/src/libs6/s6lock_acquire.c
+++ b/src/libs6/s6lock_acquire.c
@@ -8,13 +8,12 @@
#include <skalibs/uint32.h>
#include <skalibs/tai.h>
#include <skalibs/gensetdyn.h>
-#include <skalibs/skaclient.h>
+#include <skalibs/textclient.h>
#include <s6/s6lock.h>
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 = strlen(path) ;
- char err ;
char tmp[23] = "--<" ;
struct iovec v[2] = { { .iov_base = tmp, .iov_len = 23 }, { .iov_base = (char *)path, .iov_len = pathlen + 1 } } ;
uint32_t i ;
@@ -29,16 +28,13 @@ int s6lock_acquire (s6lock_t *a, uint16_t *u, char const *path, uint32_t options
uint32_pack_big(tmp+3, options) ;
tain_pack(tmp+7, limit) ;
uint32_pack_big(tmp+19, (uint32_t)pathlen) ;
- if (!skaclient_sendv(&a->connection, v, 2, &skaclient_default_cb, &err, deadline, stamp))
+ if (!textclient_commandv(&a->connection, v, 2, deadline, stamp))
{
+ int e = errno ;
gensetdyn_delete(&a->data, i) ;
+ errno = e ;
return 0 ;
}
- if (err)
- {
- gensetdyn_delete(&a->data, i) ;
- return (errno = err, 0) ;
- }
*GENSETDYN_P(char, &a->data, i) = EAGAIN ;
*u = i ;
return 1 ;