diff options
Diffstat (limited to 'src/libs6rc/s6rc_servicedir_copy_online.c')
-rw-r--r-- | src/libs6rc/s6rc_servicedir_copy_online.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/libs6rc/s6rc_servicedir_copy_online.c b/src/libs6rc/s6rc_servicedir_copy_online.c index 902e6ad..e676d5a 100644 --- a/src/libs6rc/s6rc_servicedir_copy_online.c +++ b/src/libs6rc/s6rc_servicedir_copy_online.c @@ -1,10 +1,10 @@ /* ISC license. */ -#include <sys/types.h> +#include <sys/stat.h> +#include <string.h> #include <errno.h> #include <unistd.h> #include <stdio.h> -#include <skalibs/bytestr.h> #include <skalibs/djbunix.h> #include <s6-rc/s6rc-utils.h> #include "s6rc-servicedir-internal.h" @@ -12,8 +12,8 @@ int s6rc_servicedir_copy_online (char const *src, char const *dst) { - size_t srclen = str_len(src) ; - size_t dstlen = str_len(dst) ; + size_t srclen = strlen(src) ; + size_t dstlen = strlen(dst) ; unsigned int n ; unsigned int i = 0 ; int wantup = 0 ; @@ -21,11 +21,11 @@ int s6rc_servicedir_copy_online (char const *src, char const *dst) char srcfn[srclen + s6rc_servicedir_file_maxlen + 6] ; char dstfn[dstlen + s6rc_servicedir_file_maxlen + 6] ; char oldfn[dstlen + s6rc_servicedir_file_maxlen + 6] ; - byte_copy(srcfn, srclen, src) ; + memcpy(srcfn, src, srclen) ; srcfn[srclen] = '/' ; - byte_copy(dstfn, dstlen + 1, dst) ; - byte_copy(oldfn, dstlen, dst) ; - byte_copy(oldfn + dstlen, 5, "/old") ; + memcpy(dstfn, dst, dstlen + 1) ; + memcpy(oldfn, dst, dstlen) ; + memcpy(oldfn + dstlen, "/old", 5) ; if (rm_rf(oldfn) < 0 && errno != ENOENT) return 0 ; if (mkdir(oldfn, 0755) < 0) return 0 ; dstfn[dstlen] = '/' ; @@ -35,8 +35,8 @@ int s6rc_servicedir_copy_online (char const *src, char const *dst) for (; s6rc_servicedir_file_list[i].name ; i++) { - str_copy(dstfn + dstlen + 1, s6rc_servicedir_file_list[i].name) ; - str_copy(oldfn + dstlen + 5, s6rc_servicedir_file_list[i].name) ; + strcpy(dstfn + dstlen + 1, s6rc_servicedir_file_list[i].name) ; + strcpy(oldfn + dstlen + 5, s6rc_servicedir_file_list[i].name) ; if (rename(dstfn, oldfn) < 0 && (errno != ENOENT || s6rc_servicedir_file_list[i].options & SVFILE_MANDATORY)) { @@ -61,15 +61,15 @@ int s6rc_servicedir_copy_online (char const *src, char const *dst) errremove: for (; i < n ; i++) { - str_copy(dstfn + dstlen + 1, s6rc_servicedir_file_list[i].name) ; + strcpy(dstfn + dstlen + 1, s6rc_servicedir_file_list[i].name) ; rm_rf(dstfn) ; } i = n ; errrename: while (i--) { - str_copy(dstfn + dstlen + 1, s6rc_servicedir_file_list[i].name) ; - str_copy(oldfn + dstlen + 5, s6rc_servicedir_file_list[i].name) ; + strcpy(dstfn + dstlen + 1, s6rc_servicedir_file_list[i].name) ; + strcpy(oldfn + dstlen + 5, s6rc_servicedir_file_list[i].name) ; rename(oldfn, dstfn) ; } errdir: |