summaryrefslogtreecommitdiff
path: root/src/libstddjb/filecopy_suffix.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstddjb/filecopy_suffix.c')
-rw-r--r--src/libstddjb/filecopy_suffix.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libstddjb/filecopy_suffix.c b/src/libstddjb/filecopy_suffix.c
index 70673ea..3cc5218 100644
--- a/src/libstddjb/filecopy_suffix.c
+++ b/src/libstddjb/filecopy_suffix.c
@@ -1,22 +1,22 @@
/* ISC license. */
+#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <stdio.h>
-#include <skalibs/bytestr.h>
#include <skalibs/djbunix.h>
int filecopy_suffix (char const *src, char const *dst, unsigned int mode, char const *suffix)
{
- unsigned int dstlen = str_len(dst) ;
- unsigned int suffixlen = str_len(suffix) ;
+ size_t dstlen = strlen(dst) ;
+ size_t suffixlen = strlen(suffix) ;
char tmp[dstlen + suffixlen + 1] ;
- byte_copy(tmp, dstlen, dst) ;
- byte_copy(tmp + dstlen, suffixlen + 1, suffix) ;
+ memcpy(tmp, dst, dstlen) ;
+ memcpy(tmp + dstlen, suffix, suffixlen + 1) ;
if (!filecopy_unsafe(src, tmp, mode)) return 0 ;
if (rename(tmp, dst) < 0)
{
- register int e = errno ;
+ int e = errno ;
unlink(tmp) ;
errno = e ;
return 0 ;