]> git.ipfire.org Git - thirdparty/git.git/blame - compat/strlcpy.c
Sync with 2.16.6
[thirdparty/git.git] / compat / strlcpy.c
CommitLineData
85023577 1#include "../git-compat-util.h"
817151e6
PE
2
3size_t gitstrlcpy(char *dest, const char *src, size_t size)
4{
5 size_t ret = strlen(src);
6
7 if (size) {
8 size_t len = (ret >= size) ? size - 1 : ret;
9 memcpy(dest, src, len);
10 dest[len] = '\0';
11 }
12 return ret;
13}