MCPcopy Create free account
hub / github.com/RsyncProject/rsync / strlcpy

Function strlcpy

lib/compat.c:118–129  ·  view source on GitHub ↗

* Like strncpy but does not 0 fill the buffer and always null * terminates. * * @param bufsize is the size of the destination buffer. * * @return index of the terminating byte. **/

Source from the content-addressed store, hash-verified

116 * @return index of the terminating byte.
117 **/
118 size_t strlcpy(char *d, const char *s, size_t bufsize)
119{
120 size_t len = strlen(s);
121 size_t ret = len;
122 if (bufsize > 0) {
123 if (len >= bufsize)
124 len = bufsize-1;
125 memcpy(d, s, len);
126 d[len] = 0;
127 }
128 return ret;
129}
130#endif
131
132#ifndef HAVE_STRLCAT

Callers 15

make_output_optionFunction · 0.85
option_errorFunction · 0.85
parse_argumentsFunction · 0.85
parse_hostspecFunction · 0.85
run_testFunction · 0.85
rwriteFunction · 0.85
log_formattedFunction · 0.85
add_ruleFunction · 0.85
parse_merge_nameFunction · 0.85
setup_merge_fileFunction · 0.85
push_local_filtersFunction · 0.85
parse_filter_fileFunction · 0.85

Calls

no outgoing calls

Tested by 1

run_testFunction · 0.68