diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2017-02-17 22:30:53 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2017-02-17 22:30:53 +0000 |
commit | fdffefb8032922ce7ffe4c00816072a8ff2148fc (patch) | |
tree | bc7313151a429c45d8bab8ad8b9dd32f4e51335f /src/libstddjb/filecopy_suffix.c | |
parent | a896ca2a8c617e5e00ffd5fc9e69331ad754e5b3 (diff) | |
download | skalibs-fdffefb8032922ce7ffe4c00816072a8ff2148fc.tar.xz |
More types changes
New disize
Add size_t to the autotypes list
Delete redundant and replace-libc files
dev_t/ino_t pass
Big size_t pass
More things missing, still not operational yet
Diffstat (limited to 'src/libstddjb/filecopy_suffix.c')
-rw-r--r-- | src/libstddjb/filecopy_suffix.c | 12 |
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 ; |