diff --git a/src/pdumper.c b/src/pdumper.c index c00f8a0af5..c4d48cc575 100644 --- a/src/pdumper.c +++ b/src/pdumper.c @@ -326,10 +326,16 @@ dump_reloc_set_offset (struct dump_reloc *reloc, dump_off offset) static void dump_fingerprint (const char *label, unsigned char const *xfingerprint) { - fprintf (stderr, "%s: ", label); + /* The maximum length of LABEL. If you change code that calls this + function you may need to change this value. */ + enum { max_label_length = sizeof "desired fingerprint" - 1 }; + + char buf[max_label_length + sizeof ": \n" + 2 * 32]; + int buflen = sprintf (buf, "%s: ", label); for (int i = 0; i < 32; ++i) - fprintf (stderr, "%02x", (unsigned) xfingerprint[i]); - fprintf (stderr, "\n"); + buflen += sprintf (buf + buflen, "%02x", (unsigned) xfingerprint[i]); + buf[buflen++] = '\n'; + fwrite (buf, 1, buflen, stderr); } /* Format of an Emacs portable dump file. All offsets are relative to