stpcpy returns a pointer to the end of the string just copied
which in theory makes it easier to then copy another string
after it. We only use stpcpy in one place though and that
is trivially rewritten to avoid stpcpy with no loss in code
clarity or efficiency.
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
socket
stat-time
stdarg
-stpcpy
strchrnul
strdup-posix
strndup
size_t len = strlen(errnoDetail);
if (0 <= n && n + 2 + len < sizeof(msgDetailBuf)) {
- char *p = msgDetailBuf + n;
- stpcpy(stpcpy(p, ": "), errnoDetail);
+ strcpy(msgDetailBuf + n, ": ");
+ n += 2;
+ strcpy(msgDetailBuf + n, errnoDetail);
msgDetail = msgDetailBuf;
}
}