29 lines
1.4 KiB
Text
29 lines
1.4 KiB
Text
Avoid printf %n
|
|
|
|
Index: apps/rehash.c
|
|
--- apps/rehash.c.orig
|
|
+++ apps/rehash.c
|
|
@@ -427,8 +427,9 @@ static int do_dir(const char *dirname, enum Hash h)
|
|
while (bit_isset(idmask, nextid))
|
|
nextid++;
|
|
|
|
- BIO_snprintf(buf, buflen, "%s%s%n%08x.%s%d",
|
|
- dirname, pathsep, &n, bp->hash,
|
|
+ n = BIO_snprintf(buf, buflen, "%s%s", dirname, pathsep);
|
|
+ BIO_snprintf(&buf[n], buflen - n, "%08x.%s%d",
|
|
+ bp->hash,
|
|
suffixes[bp->type], nextid);
|
|
if (verbose)
|
|
BIO_printf(bio_out, "link %s -> %s\n",
|
|
@@ -449,8 +450,9 @@ static int do_dir(const char *dirname, enum Hash h)
|
|
bit_set(idmask, nextid);
|
|
} else if (remove_links) {
|
|
/* Link to be deleted */
|
|
- BIO_snprintf(buf, buflen, "%s%s%n%08x.%s%d",
|
|
- dirname, pathsep, &n, bp->hash,
|
|
+ n = BIO_snprintf(buf, buflen, "%s%s", dirname, pathsep);
|
|
+ BIO_snprintf(&buf[n], buflen - n, "%08x.%s%d",
|
|
+ bp->hash,
|
|
suffixes[bp->type], ep->old_id);
|
|
if (verbose)
|
|
BIO_printf(bio_out, "unlink %s\n",
|