diff options
author | Daniel Mack <zonque@gmail.com> | 2014-03-07 14:43:59 +0100 |
---|---|---|
committer | Daniel Mack <zonque@gmail.com> | 2014-03-07 15:15:56 +0100 |
commit | b2cdc6664ef6b56e47d38649d69b9943d9f9f5d0 (patch) | |
tree | 5aeb2628e0ba2d0b0738b999ecf6279997f61f87 /src/shared/boot-timestamps.h | |
parent | 8a39439e08cf14c22e9f1ca5e69d1ba499075051 (diff) |
manager: flush memory stream before using the buffer
When the manager receives a SIGUSR2 signal, it opens a memory stream
with open_memstream(), uses the returned file handle for logging, and
dumps the logged content with log_dump().
However, the char* buffer is only safe to use after the file handle has
been flushed with fflush, as the man pages states:
When the stream is closed (fclose(3)) or flushed (fflush(3)), the
locations pointed to by ptr and sizeloc are updated to contain,
respectively, a pointer to the buffer and the current size of the
buffer.
These values remain valid only as long as the caller performs no
further output on the stream. If further output is performed, then the
stream must again be flushed before trying to access these variables.
Without that call, dump remains NULL and the daemon crashes in
log_dump().
Diffstat (limited to 'src/shared/boot-timestamps.h')
0 files changed, 0 insertions, 0 deletions