xbps-checkvers: remove magic buffer and use fwrite for %t format

This commit is contained in:
Duncaen 2019-06-14 14:32:24 +02:00 committed by Duncan Overbruck
parent dfa6e80d13
commit 26cc209225

View File

@ -635,8 +635,7 @@ static void
rcv_printf(rcv_t *rcv, FILE *fp, const char *pkgname, const char *repover,
const char *srcver)
{
char tmpl[128], *p;
const char *f;
const char *f, *p;
for (f = rcv->format; *f; f++) {
if (*f == '\\') {
@ -661,10 +660,8 @@ rcv_printf(rcv_t *rcv, FILE *fp, const char *pkgname, const char *repover,
case 'r': fputs(repover, fp); break;
case 's': fputs(srcver, fp); break;
case 't':
xbps_strlcpy(tmpl, rcv->fname, sizeof tmpl);
if ((p = strchr(tmpl, '/')))
*p = '\0';
fputs(tmpl, fp);
p = strchr(rcv->fname, '/');
fwrite(rcv->fname, p ? (size_t)(p - rcv->fname) : strlen(rcv->fname), 1, fp);
break;
}
}