diff options
| author | Paul Eggert | 2019-07-13 10:41:46 -0700 |
|---|---|---|
| committer | Paul Eggert | 2019-07-13 16:53:21 -0700 |
| commit | 1178f98f2c0973dd1f8a66cbb4de20c0d7af3271 (patch) | |
| tree | 0d85660fe6133895571ac48b6f1403cd8cdd58d9 /src/pdumper.c | |
| parent | a8ffbb20da67b20a85ddca38e20c609144c3bef3 (diff) | |
| download | emacs-1178f98f2c0973dd1f8a66cbb4de20c0d7af3271.tar.gz emacs-1178f98f2c0973dd1f8a66cbb4de20c0d7af3271.zip | |
Avoid interleaving stderr in dump_fingerprint
* src/fns.c (hexbuf_digest): New function, containing most of
the old make_digest_string.
(make_digest_string): Use it.
* src/pdumper.c (dump_fingerprint): Rewrite to use a single
fprintf call, to avoid interleaving on GNU/Linux.
Diffstat (limited to 'src/pdumper.c')
| -rw-r--r-- | src/pdumper.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/pdumper.c b/src/pdumper.c index b80757c2071..03c00bf27b7 100644 --- a/src/pdumper.c +++ b/src/pdumper.c | |||
| @@ -324,12 +324,13 @@ dump_reloc_set_offset (struct dump_reloc *reloc, dump_off offset) | |||
| 324 | } | 324 | } |
| 325 | 325 | ||
| 326 | static void | 326 | static void |
| 327 | dump_fingerprint (const char *label, unsigned char const *xfingerprint) | 327 | dump_fingerprint (char const *label, |
| 328 | unsigned char const xfingerprint[sizeof fingerprint]) | ||
| 328 | { | 329 | { |
| 329 | fprintf (stderr, "%s: ", label); | 330 | enum { hexbuf_size = 2 * sizeof fingerprint }; |
| 330 | for (int i = 0; i < 32; ++i) | 331 | char hexbuf[hexbuf_size]; |
| 331 | fprintf (stderr, "%02x", (unsigned) xfingerprint[i]); | 332 | hexbuf_digest (hexbuf, xfingerprint, sizeof fingerprint); |
| 332 | putc ('\n', stderr); | 333 | fprintf (stderr, "%s: %.*s\n", label, hexbuf_size, hexbuf); |
| 333 | } | 334 | } |
| 334 | 335 | ||
| 335 | /* Format of an Emacs portable dump file. All offsets are relative to | 336 | /* Format of an Emacs portable dump file. All offsets are relative to |
| @@ -355,7 +356,7 @@ struct dump_header | |||
| 355 | char magic[sizeof (dump_magic)]; | 356 | char magic[sizeof (dump_magic)]; |
| 356 | 357 | ||
| 357 | /* Associated Emacs binary. */ | 358 | /* Associated Emacs binary. */ |
| 358 | unsigned char fingerprint[32]; | 359 | unsigned char fingerprint[sizeof fingerprint]; |
| 359 | 360 | ||
| 360 | /* Relocation table for the dump file; each entry is a | 361 | /* Relocation table for the dump file; each entry is a |
| 361 | struct dump_reloc. */ | 362 | struct dump_reloc. */ |