summaryrefslogtreecommitdiff
path: root/src/libs6rc/s6rc_lock.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2017-03-13 13:08:49 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2017-03-13 13:08:49 +0000
commit2270be82ade6f2e63d652602a3842aa1fca3cb7c (patch)
treed159fd148ffec62a2e8c6d79beb3e50e0514571a /src/libs6rc/s6rc_lock.c
parent1e709ae40466a7742ba8cbdeff841c6edfaa5e5e (diff)
downloads6-rc-2270be82ade6f2e63d652602a3842aa1fca3cb7c.tar.xz
Adapt to skalibs-2.5.0.0
Diffstat (limited to 'src/libs6rc/s6rc_lock.c')
-rw-r--r--src/libs6rc/s6rc_lock.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/libs6rc/s6rc_lock.c b/src/libs6rc/s6rc_lock.c
index 34c2544..dab3035 100644
--- a/src/libs6rc/s6rc_lock.c
+++ b/src/libs6rc/s6rc_lock.c
@@ -1,9 +1,7 @@
/* ISC license. */
-#include <sys/types.h>
+#include <string.h>
#include <errno.h>
-#include <skalibs/bytestr.h>
-#include <skalibs/diuint.h>
#include <skalibs/djbunix.h>
#include <s6-rc/s6rc-utils.h>
@@ -14,10 +12,10 @@ int s6rc_lock (char const *live, int lwhat, int *llfd, char const *compiled, int
if (lwhat)
{
- size_t llen = str_len(live) ;
+ size_t llen = strlen(live) ;
char lfn[llen + 6] ;
- byte_copy(lfn, llen, live) ;
- byte_copy(lfn + llen, 6, "/lock") ;
+ memcpy(lfn, live, llen) ;
+ memcpy(lfn + llen, "/lock", 6) ;
lfd = open_create(lfn) ;
if (lfd < 0) return 0 ;
if ((lwhat > 1 ? lock_ex(lfd) : lock_sh(lfd)) < 0) { e = errno ; goto lerr ; }
@@ -25,10 +23,10 @@ int s6rc_lock (char const *live, int lwhat, int *llfd, char const *compiled, int
if (cwhat)
{
- size_t clen = str_len(compiled) ;
+ size_t clen = strlen(compiled) ;
char cfn[clen + 6] ;
- byte_copy(cfn, clen, compiled) ;
- byte_copy(cfn + clen, 6, "/lock") ;
+ memcpy(cfn, compiled, clen) ;
+ memcpy(cfn + clen, "/lock", 6) ;
cfd = open_create(cfn) ;
if (cfd < 0)
if (cwhat > 1 || errno != EROFS) { e = errno ; goto lerr ; }